GOOD.utils.synthetic_data.synthetic_structsim

Utilities for generating certain graph shapes.

Functions

ba(start, width[, role_start, m])

Builds a BA preferential attachment graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- start : starting index.rst for the shape width : int size of the graph role_start : starting index.rst for the roles OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

build_graph(width_basis, basis_type, list_shapes)

This function creates a basis (scale-free, path, or cycle) and attaches elements of the type in the list randomly along the basis. Possibility to add random edges afterwards. INPUT: -------------------------------------------------------------------------------------- width_basis : width (in terms of number of nodes) of the basis basis_type : (torus, string, or cycle) shapes : list of shape list (1st arg: type of shape, next args:args for building the shape, except for the start) start : initial nb for the first node rdm_basis_plugins: boolean. Should the shapes be randomly placed along the basis (True) or regularly (False)? add_random_edges : nb of edges to randomly add on the structure m : number of edges to attach to existing node (for BA graph) OUTPUT: -------------------------------------------------------------------------------------- basis : a nx graph with the particular shape role_ids : labels for each role plugins : node ids with the attached shapes.

clique(start, nb_nodes[, nb_to_remove, ...])

Defines a clique (complete graph on nb_nodes nodes, with nb_to_remove edges that will have to be removed), index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- start : starting index.rst for the shape nb_nodes : int correspondingraph to the nb of nodes in the clique role_start : starting index.rst for the roles nb_to_remove: int-- numb of edges to remove (unif at RDM) OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

crane(start[, role_start])

Builds a house-like graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

crossgrid(start[, role_start])

Builds a house-like graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

cycle(start, len_cycle[, role_start])

Builds a cycle graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

diamond(start[, role_start])

Builds a diamond graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

dircycle(start[, role_start])

fan(start, nb_branches[, role_start])

Builds a fan-like graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- nb_branches : int correspondingraph to the nb of fan branches start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

house(start[, role_start])

Builds a house-like graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

ladder(start, width[, role_start, m])

path(start, width[, role_start])

Builds a path graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- start : starting index.rst for the shape width : int length of the path role_start : starting index.rst for the roles OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

star(start, nb_branches[, role_start])

Builds a star graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ------------- nb_branches : int correspondingraph to the nb of star branches start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ------------- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

tree(start, height[, r, role_start])

Builds a balanced r-tree of height h INPUT: ------------- start : starting index.rst for the shape height : int height of the tree r : int number of branches per node role_start : starting index.rst for the roles OUTPUT: ------------- graph : a tree shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

varcycle(start[, role_start])

wheel(start, width[, role_start, m])

GOOD.utils.synthetic_data.synthetic_structsim.ba(start, width, role_start=0, m=5)[source]

Builds a BA preferential attachment graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ————- start : starting index.rst for the shape width : int size of the graph role_start : starting index.rst for the roles OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.build_graph(width_basis, basis_type, list_shapes, start=0, rdm_basis_plugins=False, add_random_edges=0, m=5)[source]

This function creates a basis (scale-free, path, or cycle) and attaches elements of the type in the list randomly along the basis. Possibility to add random edges afterwards. INPUT: ————————————————————————————– width_basis : width (in terms of number of nodes) of the basis basis_type : (torus, string, or cycle) shapes : list of shape list (1st arg: type of shape,

next args:args for building the shape, except for the start)

start : initial nb for the first node rdm_basis_plugins: boolean. Should the shapes be randomly placed

along the basis (True) or regularly (False)?

add_random_edges : nb of edges to randomly add on the structure m : number of edges to attach to existing node (for BA graph) OUTPUT: ————————————————————————————– basis : a nx graph with the particular shape role_ids : labels for each role plugins : node ids with the attached shapes

GOOD.utils.synthetic_data.synthetic_structsim.clique(start, nb_nodes, nb_to_remove=0, role_start=0)[source]

Defines a clique (complete graph on nb_nodes nodes, with nb_to_remove edges that will have to be removed), index.rst of nodes starting at start and role_ids at role_start INPUT: ————- start : starting index.rst for the shape nb_nodes : int correspondingraph to the nb of nodes in the clique role_start : starting index.rst for the roles nb_to_remove: int– numb of edges to remove (unif at RDM) OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.crane(start, role_start=0)[source]

Builds a house-like graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ————- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.crossgrid(start, role_start=0)[source]

Builds a house-like graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ————- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.cycle(start, len_cycle, role_start=0)[source]

Builds a cycle graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ————- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.diamond(start, role_start=0)[source]

Builds a diamond graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ————- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.dircycle(start, role_start=0)[source]
GOOD.utils.synthetic_data.synthetic_structsim.fan(start, nb_branches, role_start=0)[source]

Builds a fan-like graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ————- nb_branches : int correspondingraph to the nb of fan branches start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.house(start, role_start=0)[source]

Builds a house-like graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ————- start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.ladder(start, width, role_start=0, m=5)[source]
GOOD.utils.synthetic_data.synthetic_structsim.path(start, width, role_start=0)[source]

Builds a path graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ————- start : starting index.rst for the shape width : int length of the path role_start : starting index.rst for the roles OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.star(start, nb_branches, role_start=0)[source]

Builds a star graph, with index.rst of nodes starting at start and role_ids at role_start INPUT: ————- nb_branches : int correspondingraph to the nb of star branches start : starting index.rst for the shape role_start : starting index.rst for the roles OUTPUT: ————- graph : a house shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at

role_start)

GOOD.utils.synthetic_data.synthetic_structsim.tree(start, height, r=2, role_start=0)[source]

Builds a balanced r-tree of height h INPUT: ————- start : starting index.rst for the shape height : int height of the tree r : int number of branches per node role_start : starting index.rst for the roles OUTPUT: ————- graph : a tree shape graph, with ids beginning at start roles : list of the roles of the nodes (indexed starting at role_start)

GOOD.utils.synthetic_data.synthetic_structsim.varcycle(start, role_start=0)[source]
GOOD.utils.synthetic_data.synthetic_structsim.wheel(start, width, role_start=0, m=5)[source]