|
24 | 24 |
|
25 | 25 | # TODO helper for map properties to fields. helper for set caption (simplicity) |
26 | 26 | class VisualizationGraph: |
| 27 | + """ |
| 28 | + A graph to visualize. |
| 29 | +
|
| 30 | + The `VisualizationGraph` class represents a collection of nodes and relationships that can be |
| 31 | + rendered as an interactive graph visualization. You can customize the appearance of nodes and |
| 32 | + relationships by setting their properties, colors, sizes, and other visual attributes. |
| 33 | + """ |
| 34 | + |
27 | 35 | #: "The nodes in the graph" |
28 | 36 | nodes: list[Node] |
29 | 37 | #: "The relationships in the graph" |
30 | 38 | relationships: list[Relationship] |
31 | 39 |
|
32 | 40 | def __init__(self, nodes: list[Node], relationships: list[Relationship]) -> None: |
33 | 41 | """ |
34 | | - A graph to visualize. |
35 | | -
|
36 | | - The `VisualizationGraph` class represents a collection of nodes and relationships that can be |
37 | | - rendered as an interactive graph visualization. You can customize the appearance of nodes and |
38 | | - relationships by setting their properties, colors, sizes, and other visual attributes. |
| 42 | + Parameters |
| 43 | + ---------- |
| 44 | + nodes : list[Node] |
| 45 | + The nodes in the graph. |
| 46 | + relationships : list[Relationship] |
| 47 | + The relationships in the graph. |
39 | 48 |
|
40 | 49 | Examples |
41 | 50 | -------- |
@@ -71,19 +80,6 @@ def __init__(self, nodes: list[Node], relationships: list[Relationship]) -> None |
71 | 80 | >>> # Use resize_nodes for automatic sizing |
72 | 81 | >>> VG.resize_nodes(property="degree", node_radius_min_max=(10, 50)) |
73 | 82 |
|
74 | | - Parameters |
75 | | - ---------- |
76 | | - nodes : list[Node] |
77 | | - The nodes in the graph. |
78 | | - relationships : list[Relationship] |
79 | | - The relationships in the graph. |
80 | | -
|
81 | | - Attributes |
82 | | - ---------- |
83 | | - nodes : list[Node] |
84 | | - The nodes in the graph. |
85 | | - relationships : list[Relationship] |
86 | | - The relationships in the graph. |
87 | 83 | """ |
88 | 84 | self.nodes = nodes |
89 | 85 | self.relationships = relationships |
@@ -132,6 +128,12 @@ def render( |
132 | 128 | The maximum allowed number of nodes to render. |
133 | 129 | show_hover_tooltip: |
134 | 130 | Whether to show an info tooltip when hovering over nodes and relationships. |
| 131 | +
|
| 132 | +
|
| 133 | + Example |
| 134 | + ------- |
| 135 | + Basic rendering of a VisualizationGraph: |
| 136 | + >>> from neo4j_viz import Node, Relationship, VisualizationGraph |
135 | 137 | """ |
136 | 138 |
|
137 | 139 | num_nodes = len(self.nodes) |
|
0 commit comments