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
The ``neo4j-viz`` library provides a convenience method for importing data from Neo4j.
165
166
It requires and additional dependency to be installed, which you can do by running:
@@ -171,15 +172,15 @@ It requires and additional dependency to be installed, which you can do by runni
171
172
Once you have installed the additional dependency, you can use the :doc:`from_neo4j <./api-reference/from_neo4j>` method
172
173
to import query results from Neo4j.
173
174
174
-
The ``from_neo4j`` method takes one mandatory positional parameters:
175
+
The ``from_neo4j`` method takes one mandatory positional parameter:
175
176
176
177
* A ``result`` representing the query result either in form of `neo4j.graph.Graph` or `neo4j.Result`.
177
178
178
-
The ``node_caption`` parameter is also optional, and indicates the node property to use for the caption of each node in the visualization.
179
-
180
179
We can also provide an optional ``size_property`` parameter, which should refer to a node property,
181
180
and will be used to determine the sizes of the nodes in the visualization.
182
181
182
+
The ``node_caption`` and ``relationship_caption`` parameters are also optional, and indicate the node and relationship properties to use for the captions of each element in the visualization.
183
+
183
184
The last optional property, ``node_radius_min_max``, can be used (and is used by default) to scale the node sizes for
184
185
the visualization.
185
186
It is a tuple of two numbers, representing the radii (sizes) in pixels of the smallest and largest nodes respectively in
@@ -218,3 +219,58 @@ In this small example, we import a graph from a Neo4j query result.
218
219
219
220
Please see the :doc:`Visualizing Neo4j Graphs tutorial <./tutorials/neo4j-example>` for a
220
221
more extensive example.
222
+
223
+
224
+
GQL ``CREATE`` query
225
+
--------------------
226
+
227
+
The ``neo4j-viz`` library provides a convenience method for creating visualization graphs from GQL ``CREATE`` queries via the :doc:`from_neo4j <./api-reference/from_gql_create>` method method.
228
+
229
+
The ``from_gql_create`` method takes one mandatory positional parameter:
230
+
231
+
* A valid ``query`` representing a GQL ``CREATE`` query as a string.
232
+
233
+
We can also provide an optional ``size_property`` parameter, which should refer to a node property,
234
+
and will be used to determine the sizes of the nodes in the visualization.
235
+
236
+
The ``node_caption`` and ``relationship_caption`` parameters are also optional, and indicate the node and relationship properties to use for the captions of each element in the visualization.
237
+
238
+
The last optional property, ``node_radius_min_max``, can be used (and is used by default) to scale the node sizes for
239
+
the visualization.
240
+
It is a tuple of two numbers, representing the radii (sizes) in pixels of the smallest and largest nodes respectively in
241
+
the visualization.
242
+
The node sizes will be scaled such that the smallest node will have the size of the first value, and the largest node
243
+
will have the size of the second value.
244
+
The other nodes will be scaled linearly between these two values according to their relative size.
245
+
This can be useful if node sizes vary a lot, or are all very small or very big.
246
+
247
+
248
+
Example
249
+
~~~~~~~
250
+
251
+
In this small example, we create a visualization graph from a GQL ``CREATE`` query.
252
+
253
+
.. code-block:: python
254
+
255
+
from neo4j_viz.gql_create import from_gql_create
256
+
257
+
query ="""
258
+
CREATE
259
+
(a:User {name: 'Alice', age: 23}),
260
+
(b:User {name: 'Bridget', age: 34}),
261
+
(c:User {name: 'Charles', age: 45}),
262
+
(d:User {name: 'Dana', age: 56}),
263
+
(e:User {name: 'Eve', age: 67}),
264
+
(f:User {name: 'Fawad', age: 78}),
265
+
266
+
(a)-[:LINK {weight: 0.5}]->(b),
267
+
(a)-[:LINK {weight: 4}]->(c),
268
+
(e)-[:LINK {weight: 1.1}]->(d),
269
+
(e)-[:LINK {weight: -2}]->(f);
270
+
"""
271
+
272
+
VG= from_neo4j(query)
273
+
274
+
275
+
Please see the :doc:`Visualizing Neo4j Graphs tutorial <./tutorials/neo4j-example>` for a
0 commit comments