Skip to content

Commit 5d66fe9

Browse files
FlorentinDnvitucci
andcommitted
Show examples in API reference
Co-authored-by: Nicola Vitucci <[email protected]>
1 parent 2d7f012 commit 5d66fe9

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

docs/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333

3434
# -- Options for autodoc extension -------------------------------------------
3535
autodoc_typehints = "description"
36+
autoclass_content = "both"
3637

38+
# -- Options for napoleon extension -------------------------------------------
39+
napoleon_use_admonition_for_examples = True
3740

3841
# -- Options for HTML output -------------------------------------------------
3942
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

python-wrapper/src/neo4j_viz/visualization_graph.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,27 @@
2424

2525
# TODO helper for map properties to fields. helper for set caption (simplicity)
2626
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+
2735
#: "The nodes in the graph"
2836
nodes: list[Node]
2937
#: "The relationships in the graph"
3038
relationships: list[Relationship]
3139

3240
def __init__(self, nodes: list[Node], relationships: list[Relationship]) -> None:
3341
"""
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.
3948
4049
Examples
4150
--------
@@ -71,19 +80,6 @@ def __init__(self, nodes: list[Node], relationships: list[Relationship]) -> None
7180
>>> # Use resize_nodes for automatic sizing
7281
>>> VG.resize_nodes(property="degree", node_radius_min_max=(10, 50))
7382
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.
8783
"""
8884
self.nodes = nodes
8985
self.relationships = relationships
@@ -132,6 +128,12 @@ def render(
132128
The maximum allowed number of nodes to render.
133129
show_hover_tooltip:
134130
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
135137
"""
136138

137139
num_nodes = len(self.nodes)

0 commit comments

Comments
 (0)