dag.visualization
cloud.dag.visualization
Functions
Name | Description |
---|---|
build_graph_node_details | |
build_visualization_positions | Builds the positional spacing of all nodes(markers) based on either pydot |
hierarchy_pos | Taken from https://epidemicsonnetworks.readthedocs.io/en/latest/_modules/EoN/auxiliary.html#hierarchy_pos |
update_plotly_graph | Update a graph based on based node status and figure |
update_tiledb_graph | Update a tiledb plot widge graph |
build_graph_node_details
cloud.dag.visualization.build_graph_node_details(nodes)
Parameters
Name | Type | Description | Default |
---|---|---|---|
nodes | List of nodes to get status of | required |
Returns
Name | Type | Description |
---|---|---|
tuple of node_colors and node_text |
build_visualization_positions
cloud.dag.visualization.build_visualization_positions(network)
Builds the positional spacing of all nodes(markers) based on either pydot if available or falling back to a python computation
Parameters
Name | Type | Description | Default |
---|---|---|---|
network | required |
Returns
Name | Type | Description |
---|---|---|
position array |
hierarchy_pos
cloud.dag.visualization.hierarchy_pos(
G=None
root=1.0
width=0.2
vert_gap=0
vert_loc=0.5
leaf_vs_root_factor )
Taken from https://epidemicsonnetworks.readthedocs.io/en/latest/_modules/EoN/auxiliary.html#hierarchy_pos Licensed under MIT: https://epidemicsonnetworks.readthedocs.io/en/latest/_downloads/8e9c8138fef49ddba8102fa7799c29d7/license.txt
If the graph is a tree this will return the positions to plot this in a hierarchical layout.
Based on Joel’s answer at https://stackoverflow.com/a/29597209/2966723, but with some modifications.
We include this because it may be useful for plotting transmission trees, and there is currently no networkx equivalent (though it may be coming soon).
There are two basic approaches we think of to allocate the horizontal location of a node.
- Top down: we allocate horizontal space to a node. Then its
k
descendants split up that horizontal space equally. This tends to result in overlapping nodes when some have many descendants. - Bottom up: we allocate horizontal space to each leaf node. A node at a higher level gets the entire space allocated to its descendant leaves. Based on this, leaf nodes at higher levels get the same space as leaf nodes very deep in the tree.
We use use both of these approaches simultaneously with leaf_vs_root_factor
determining how much of the horizontal space is based on the bottom up or top down approaches. 0
gives pure bottom up, while 1 gives pure top down.
:Arguments:
G the graph (must be a tree)
root the root node of the tree - if the tree is directed and this is not given, the root will be found and used - if the tree is directed and this is given, then the positions will be just for the descendants of this node. - if the tree is undirected and not given, then a random choice will be used.
width horizontal space allocated for this branch - avoids overlap with other branches
vert_gap gap between levels of hierarchy
vert_loc vertical location of root
leaf_vs_root_factor
xcenter: horizontal location of root
update_plotly_graph
=None) cloud.dag.visualization.update_plotly_graph(nodes, fig
Update a graph based on based node status and figure
Parameters
Name | Type | Description | Default |
---|---|---|---|
nodes | list of notes to update | required | |
fig | None |
Returns
Name | Type | Description |
---|---|---|
update_tiledb_graph
cloud.dag.visualization.update_tiledb_graph(
nodes
edges
node_details
positions
fig )
Update a tiledb plot widge graph
Parameters
Name | Type | Description | Default |
---|---|---|---|
nodes | nodes of graph | required | |
edges | edges for graph | required | |
node_details | Node details | required | |
positions | positions for graph | required | |
fig | figure | required |
Returns
Name | Type | Description |
---|---|---|