Skip to content

Commit f8a3fa5

Browse files
committed
WIP: Add a Getting Started section to the docs
1 parent a3feed3 commit f8a3fa5

7 files changed

Lines changed: 86 additions & 12 deletions

File tree

docs/source/api-reference/graph.rst

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/source/api-reference/node.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.. autoclass:: neo4j_viz.Node
2+
:members:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.. autoclass:: neo4j_viz.Relationship
2+
:members:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.. autoclass:: neo4j_viz.VisualizationGraph
2+
:members:

docs/source/getting-started.rst

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,79 @@
11
Getting Started
2-
---------------
2+
===============
3+
4+
In this section, we will cover the very basics of creating a visualization graph using the `neo4j-viz` library.
5+
We will use a small toy graph representing the purchase history of a few people and products.
6+
7+
To follow along with the example below, please make sure you have :doc:`installed the library<./installation>` first.
8+
9+
We start by instantiating the :doc:`Nodes <./api-reference/node>` and :doc:`Relationships <./api-reference/relationship>` we want in our graph.
10+
The only mandatory fields for a node are the "id", and "source" and "target" for a relationship.
11+
But the other fields can optionally be used customize the appearance of the nodes and relationships in the visualization.
12+
13+
Lastly we instantiate a :doc:`VisualizationGraph <./api-reference/visualization-graph>` object with the nodes and relationships we created, and call its `render` method to display the graph.
14+
15+
.. code-block:: python
16+
17+
nodes = [
18+
Node(id=0, size=10, caption="Person"),
19+
Node(id=1, size=10, caption="Product"),
20+
Node(id=2, size=20, caption="Product"),
21+
Node(id=3, size=10, caption="Person"),
22+
Node(id=4, size=10, caption="Product"),
23+
]
24+
relationships = [
25+
Relationship(
26+
source=0,
27+
target=1,
28+
caption="BUYS",
29+
),
30+
Relationship(
31+
source=0,
32+
target=2,
33+
caption="BUYS",
34+
),
35+
Relationship(
36+
source=3,
37+
target=2,
38+
caption="BUYS",
39+
),
40+
]
41+
42+
VG = VisualizationGraph(nodes=nodes, relationships=relationships)
43+
44+
VG.render()
45+
46+
TODO: Add graphics here
47+
48+
As we can see in the graph above, the radius of one of the nodes is larger than the others.
49+
This is because we set the "size" field of the node to 20, while the others are set to 10.
50+
51+
At this time all nodes have the same color.
52+
If we want to distinguish between the different types of nodes, we can color them differently with the `color_nodes` method.
53+
We can pass the field we want to use to color the nodes as an argument.
54+
In this case, we will use the "caption" field.
55+
Nodes with the same "caption" will have the same color.
56+
We will use the default colorscheme, which is the Neo4j colorscheme.
57+
58+
.. code-block:: python
59+
60+
VG.color_nodes("caption")
61+
62+
VG.render()
63+
64+
TODO: Add graphics here
65+
66+
We are now easily able to distinguish between the different types of nodes in the graph.
67+
68+
Next steps
69+
----------
70+
71+
Now that we have covered the basics of creating and rendering a visualization graph, we can move on to more advanced topics.
72+
73+
Here are some suggestions for what to do next:
74+
75+
* Import a graph from pandas dataframes: :doc:`API reference <./api-reference/from_pandas>` and :doc:`notebook example <./tutorials/snowpark-nvl-example>`
76+
* Import a graph from Neo4j Graph Data Science: :doc:`API reference <./api-reference/from_gds>` and :doc:`notebook example <./tutorials/gds-nvl-example>`
77+
* Customize the appearance of the nodes and relationships: :doc:`Node API reference <./api-reference/node>` and :doc:`Relationship API reference <./api-reference/relationship>`
78+
* Check out the rendering options and convenience methods of `VisualizationGraph`: :doc:`VisualizationGraph API reference <./api-reference/visualization-graph>`
79+
* Browse the :doc:`tutorials <./tutorials/index>` for more examples and use cases

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Graph Visualization for Python by Neo4j documentation
77
=====================================================
88

9-
This is the documentation for the `neo4j_viz` Python library by Neo4j for creating interactive graph visualizations.
9+
This is the documentation for the `neo4j-viz` Python library by Neo4j for creating interactive graph visualizations.
1010

1111

1212
.. toctree::

docs/source/tutorials/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Tutorials
77
=====================================================
88

9-
This chapter contains Jupyter notebook tutorials for the `neo4j_viz` package.
9+
This chapter contains Jupyter notebook tutorials for the `neo4j-viz` package.
1010

1111

1212
.. toctree::

0 commit comments

Comments
 (0)