Networks¶
Some network models and layout functions.
-
epipack.networks.
get_2D_lattice_links
(N_side, periodic=False, diagonal_links=False)[source]¶ Return the links of a square 2D lattice
-
epipack.networks.
get_grid_layout
(N_nodes, edge_weight_tuples=[], windowwidth=400, linkwidth=1)[source]¶ Returns a stylized network dictionary that puts nodes in a grid layout.
- Parameters
N_nodes (int) -- The number of nodes in the network
edge_weight_tuples (list, default = []) --
A list of tuples. Each tuple describes an edge with the first entry being the source node index, the second entry being the target node indes and the third entry being the weight, e.g.
[ (0, 1, 1.0) ]
windowwidth (float, default = 400) -- The width of the network visualization
linkwidth (float, default = 1.0) -- All links get the same width.
- Returns
network -- A stylized network dictionary in netwulf-format.
- Return type
-
epipack.networks.
get_random_layout
(N_nodes, edge_weight_tuples=[], windowwidth=400, linkwidth=1, node_scale_by_degree=0.5, circular=True)[source]¶ Returns a stylized network dictionary that puts nodes in a random layout.
- Parameters
N_nodes (int) -- The number of nodes in the network
edge_weight_tuples (list, default = []) --
A list of tuples. Each tuple describes an edge with the first entry being the source node index, the second entry being the target node index and the third entry being the weight, e.g.
[ (0, 1, 1.0) ]
windowwidth (float, default = 400) -- The width of the network visualization
linkwidth (float, default = 1.0) -- All links get the same width.
node_scale_by_degree (float, default = 0.5) -- Scale the node radius by
degree**node_scale_by_degree
. Per default, the node disk area will be proportional to the degree. If you want all nodes to be equally sized, setnode_scale_by_degree = 0
.circular (bool, default = True) -- Use a circular or square layout
- Returns
network -- A stylized network dictionary in netwulf-format.
- Return type
-
epipack.networks.
get_small_world_layout
(N_nodes, edge_weight_tuples=[], windowwidth=400, linkwidth=1, node_scale_by_degree=2, nbounce=20, Rbounce=0.1, R=0.8)[source]¶ Returns a stylized network dictionary that puts nodes in a small-world inspired circular layout. The ring of nodes will be drawn bouncy to better display connections between nearby regions. Nodes that connect far-away regions of a network will be displayed more centrally. Distance is defined as lattice distance by integer node id. Hence, nodes must be integers in [0,N).
- Parameters
N_nodes (int) -- The number of nodes in the network
edge_weight_tuples (list, default = []) --
A list of tuples. Each tuple describes an edge with the first entry being the source node index, the second entry being the target node index and the third entry being the weight, e.g.
[ (0, 1, 1.0) ]
windowwidth (float, default = 400) -- The width of the network visualization
linkwidth (float, default = 1.0) -- All links get the same width.
node_scale_by_degree (float, default = 2) -- Scale the node radius by
degree**node_scale_by_degree
. If you want all nodes to be equally sized, setnode_scale_by_degree = 0
.nbounce (int, default = 20) -- How wobbly the outer shell should be.
Rbounce (int, default = 0.1) -- How thick the outer shell should be (in units of half window width)
R (float, default = 0.8) -- How large the radius of the whole layout should be (in units of half window width)
- Returns
network -- A stylized network dictionary in netwulf-format.
- Return type