mercury.graph.viz
mercury.graph.viz.Moebius(G)
Bases: MoebiusAnywidget
Moebius class for visualizing graphs using an anywidget.
Usage
from mercury.graph.viz import Moebius
G = ... # A graph object
moebius = Moebius(G)
moebius.show()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
G
|
Graph
|
The graph to be visualized. |
required |
Source code in mercury/graph/viz/moebius.py
453 454 455 456 457 |
|
__getitem__(item)
Add support for the [] operator.
Source code in mercury/graph/viz/moebius.py
125 126 127 128 129 130 |
|
__str__()
Convert the object via str()
Source code in mercury/graph/viz/moebius.py
117 118 119 120 121 122 |
|
node_or_edge_config(text_is=None, color_is=None, colors=None, size_is=None, size_range=None, size_scale='linear')
Create a node_config
or edge_config
configuration dictionary for show()
in an understandable way.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text_is
|
str
|
The node/edge attribute to be displayed as text. Use the string |
None
|
color_is
|
str
|
A categorical node/edge attribute that can be represented as a color. This will also enable a legend interface where categories can be individually shown or hidden. |
None
|
colors
|
dict
|
The colors for each category defined as a dictionary. The keys are possible outcomes of category. The values are html RGB strings. E.g., .draw(category = 'size', colors = {'big' : '#c0a080', 'small' : '#a0c080'}) where 'big' and 'small' are possible values of the category 'size'. |
None
|
size_is
|
str
|
The node attribute to be displayed as the size of the nodes. Use the string |
None
|
size_range
|
List of two numbers
|
Combined with edge_label, this parameter controls the values in the variable that correspond to the minimum and maximum displayed sizes. The values below or equal the first value will be displayed with the base radius (that depends on the zoom) and the values above or equal to the second value will be shown with the maximum radius. |
None
|
size_scale
|
(linear, power, sqrt or log)
|
Combined with edge_label, the scale used to convert the value in the variable to the displayed radius. |
'linear'
|
Returns:
Type | Description |
---|---|
dict
|
The node configuration dictionary |
Source code in mercury/graph/viz/moebius.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
show(initial_id=None, initial_depth=1, node_config=None, edge_config=None)
Start the interactive graph visualization using an anywidget.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
initial_id
|
str
|
The id of the node to start the visualization. |
None
|
initial_depth
|
int
|
The initial depth of the graph (starting with |
1
|
node_config
|
dict
|
A node configuration dictionary created by |
None
|
edge_config
|
dict
|
An edge configuration dictionary created by |
None
|
Source code in mercury/graph/viz/moebius.py
467 468 469 470 471 472 473 474 475 476 477 |
|