You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/index.rst
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,9 @@ The library allows you to visualize graph data interactively in Python using a s
11
11
12
12
The library wraps the `Neo4j Visualization JavaScript library (NVL) <https://neo4j.com/docs/nvl/current/>`_, and
13
13
provides additional features for working with graph data in Python.
14
-
Notably, there are convenience methods for importing data from `Pandas DataFrames <https://pandas.pydata.org/>`_,
15
-
`Neo4j Graph Data Science <https://neo4j.com/docs/graph-data-science/current/>`_ and `Neo4j Database <https://neo4j.com/docs/python-manual/current/>`_.
14
+
Notably, there are convenience methods for importing data from source such as `Pandas DataFrames <https://pandas.pydata.org/>`_,
15
+
`Neo4j Graph Data Science <https://neo4j.com/docs/graph-data-science/current/>`_, `Neo4j Database <https://neo4j.com/docs/python-manual/current/>`_
16
+
and `Snowflake tables <https://docs.snowflake.com/>`_.
16
17
17
18
The source code is available on `GitHub <https://github.com/neo4j/python-graph-visualization>`_.
18
19
If you have a suggestion on how we can improve the library or want to report a problem, you can create a `new issue <https://github.com/neo4j/python-graph-visualization/issues/new>`_.
@@ -118,9 +116,9 @@ and will be used to determine the sizes of the nodes in the visualization.
118
116
119
117
The ``additional_node_properties`` parameter is also optional, and should be a list of additional node properties of the
120
118
projection that you want to include in the visualization.
121
-
The default is `None`, which means that all properties of the nodes in the projection will be included.
119
+
The default is ``None``, which means that all properties of the nodes in the projection will be included.
122
120
Apart from being visible through on-hover tooltips, these properties could be used to color the nodes, or give captions
123
-
to them in the visualization, or simply included in the nodes' `Node.properties` maps without directly impacting the
121
+
to them in the visualization, or simply included in the nodes' ``Node.properties`` maps without directly impacting the
124
122
visualization.
125
123
126
124
The last optional property, ``node_radius_min_max``, can be used (and is used by default) to scale the node sizes for
@@ -285,3 +283,122 @@ In this small example, we create a visualization graph from a GQL ``CREATE`` que
285
283
"""
286
284
287
285
VG= from_gql_create(query)
286
+
287
+
288
+
Snowflake Tables
289
+
----------------
290
+
291
+
The ``neo4j-viz`` library provides a convenience method for importing data from Snowflake tables.
292
+
It requires and additional dependency to be installed, which you can do by running:
293
+
294
+
.. code-block:: bash
295
+
296
+
pip install neo4j-viz[snowflake]
297
+
298
+
Once you have installed the additional dependency, you can use the :doc:`from_snowflake <./api-reference/from_snowflake>` method
299
+
to import Snowflake tables into a ``VisualizationGraph``.
300
+
301
+
The ``from_snowflake`` method takes two mandatory positional parameters:
302
+
303
+
* A ``snowflake.snowpark.Session`` object for the connection to Snowflake, and
304
+
* A `project configuration <https://neo4j.com/docs/snowflake-graph-analytics/current/jobs/#jobs-project>`_ as a dictionary, that specifies how you want your tables to be projected as a graph.
305
+
This configuration is the same as the project configuration of the `Neo4j Snowflake Graph Analytics application <https://neo4j.com/docs/snowflake-graph-analytics/current/>`_.
306
+
307
+
``from_snowflake`` also takes an optional property, ``node_radius_min_max``, that can be used (and is used by default) to
308
+
scale the node sizes for the visualization.
309
+
It is a tuple of two numbers, representing the radii (sizes) in pixels of the smallest and largest nodes respectively in
310
+
the visualization.
311
+
The node sizes will be scaled such that the smallest node will have the size of the first value, and the largest node
312
+
will have the size of the second value.
313
+
The other nodes will be scaled linearly between these two values according to their relative size.
314
+
This can be useful if node sizes vary a lot, or are all very small or very big.
315
+
316
+
317
+
Special columns
318
+
~~~~~~~~~~~~~~~
319
+
320
+
It is possible to modify the visualization directly by including columns of certain specific names in the node and relationship tables.
321
+
322
+
All such special columns can be found :doc:`here <./api-reference/node>` for nodes and :doc:`here <./api-reference/relationship>` for relationships.
323
+
Though listed in ``snake_case`` here, ``SCREAMING_SNAKE_CASE`` and ``camelCase`` are also supported.
324
+
Some of the most commonly used special columns are:
325
+
326
+
* **Node sizes**: The sizes of nodes can be controlled by including a column named "SIZE" in node tables.
327
+
The values in these columns should be of a numeric type. This can be useful for visualizing the relative importance or size of nodes in the graph, for example using a computed centrality score.
328
+
329
+
* **Captions**: The caption text of nodes and relationships can be controlled by including a column named "CAPTION" in the tables.
330
+
The values in these columns should be of a string type. This can be useful for displaying additional information about the nodes, such as their names or labels. If no "CAPTION" column is provided, the default captions in the visualization will be the names of the corresponding node and relationship tables.
331
+
332
+
Please also note that you can further customize the visualization after the `VisualizationGraph` has been created, by using the methods described in the :doc:`Customizing the visualization <./customizing>` section.
333
+
334
+
335
+
Default behavior
336
+
~~~~~~~~~~~~~~~~
337
+
338
+
Unless there are "CAPTION" columns in the tables, the node and relationship captions will be set to the names of the corresponding tables.
339
+
Similarly, if there are are no "COLOR" node table columns, the nodes will be colored be colored so that nodes from the same table have the same color, and different tables have different colors.
340
+
341
+
342
+
Example
343
+
~~~~~~~
344
+
345
+
In this small example, we import a toy graph representing a social network from two tables in Snowflake.
0 commit comments