Skip to content

Commit 2ee0008

Browse files
authored
Merge pull request #2124 from Mats-SX/1.4-graph-list-docs
1.4 - Improve `graph.list` docs
2 parents c5006d1 + b131767 commit 2ee0008

File tree

1 file changed

+77
-19
lines changed

1 file changed

+77
-19
lines changed

doc/asciidoc/management-ops/graph-catalog.adoc

Lines changed: 77 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,52 +111,110 @@ After creating the graphs in the catalog, we can refer to them in algorithms by
111111
CALL gds.pageRank.stream('my-native-graph') YIELD nodeId, score;
112112
----
113113

114+
114115
[[catalog-graph-list]]
115116
== Listing graphs in the catalog
116117

117-
Once we have created graphs in the catalog, we can list information about either all of them or a single graph using its name.
118-
There is one return field, `degreeDistribution`, which can be fairly time-consuming for large graphs.
119-
Its computation is however cached per graph, so subsequent listing of the same graph is fast.
120-
Moreover, `degreeDistribution` is only computed when included in the `YIELD` subclause, or if no `YIELD` clause is given.
118+
Information about graphs in the catalog can be listed using the `gds.graph.list()` procedure.
119+
The procedure takes an optional parameter `graphName`:
120+
121+
* If a graph name is given, only information for that graph will be listed.
122+
* If no graph name is given, information about all graphs will be listed.
123+
* If a graph name is given but not found in the catalog, an error will be raised.
121124

122-
.List information about all graphs in the catalog with all return columns except `degreeDistribution`:
125+
.List information about graphs in the catalog:
123126
[source,cypher]
124127
----
125-
CALL gds.graph.list()
126-
YIELD graphName, database, nodeProjection, relationshipProjection, nodeQuery, relationshipQuery,
127-
nodeCount, relationshipCount, density, schema, creationTime, modificationTime, sizeInBytes, memoryUsage;
128-
----
128+
CALL gds.graph.list(
129+
graphName: String?
130+
) YIELD
131+
graphName,
132+
database,
133+
nodeProjection,
134+
relationshipProjection,
135+
nodeQuery,
136+
relationshipQuery,
137+
nodeCount,
138+
relationshipCount,
139+
schema,
140+
degreeDistribution,
141+
density,
142+
creationTime,
143+
modificationTime,
144+
sizeInBytes,
145+
memoryUsage;
146+
----
147+
148+
.Results
149+
[opts="header",cols="1m,1,6"]
150+
|===
151+
| Name | Type | Description
152+
| graphName | String | Name of the graph.
153+
| database | String | Name of the database in which the graph has been created.
154+
| nodeProjection | Map | Node projection used to create the graph. If a Cypher projection was used, this will be a derived node projection.
155+
| relationshipProjection | Map | Relationship projection used to create the graph. If a Cypher projection was used, this will be a derived relationship projection.
156+
| nodeQuery | String | Node query used to create the graph. If a native projection was used, this will be `null`.
157+
| relationshipQuery | String | Relationship query used to create the graph. If a native projection was used, this will be `null`.
158+
| nodeCount | Integer | Number of nodes in the graph.
159+
| relationshipCount | Integer | Number of relationships in the graph.
160+
| schema | Map | Node labels, Relationship types and properties contained in the in-memory graph.
161+
| degreeDistribution | Map | Histogram of degrees in the graph.
162+
| density | Float | Density of the graph.
163+
| creationTime | Datetime | Time when the graph was created.
164+
| modificationTime | Datetime | Time when the graph was last modified.
165+
| sizeInBytes | Integer | Number of bytes used in the Java heap to store the graph.
166+
| memoryUsage | String | Human readable description of `sizeInBytes`.
167+
|===
129168

130-
The `nodeProjection` and `relationshipProjection` columns are primarily applicable to <<native-projection, Native projection>>.
131-
The `nodeQuery` and `relationshipQuery` columns are applicable only to <<cypher-projection, Cypher projection>> and are `null` for graphs created with Native projection.
169+
The information contains basic statistics about the graph, e.g., the node and relationship count.
170+
The result field `creationTime` indicates when the graph was created in memory.
171+
The result field `modificationTime` indicates when the graph was updated by an algorithm running in `mutate` mode.
132172

133173
The `database` column refers to the name of the database the corresponding graph has been created on.
134174
Referring to a named graph in a procedure is only allowed on the database it has been created on.
135175

136176
The `schema` consists of information about the nodes and relationships stored in the graph.
137177
For each node label, the schema maps the label to its property keys and their corresponding property types.
138178
Similarly, the schema maps the relationship types to their property keys and property types.
139-
The property type is either `Integer` or `Float`.
179+
The property type is either `Integer`, `Float`, `List of Integer` or `List of Float`.
180+
181+
The `degreeDistribution` field can be fairly time-consuming to compute for larger graphs.
182+
Its computation is cached per graph, so subsequent listing for the same graph will be fast.
183+
To avoid computing the degree distribution, specify a `YIELD` clause that omits it.
184+
Note that not specifying a `YIELD` clause is the same as requesting all possible return fields to be returned.
140185

141186
The `density` is the result of `relationshipCount` divided by the maximal number of relationships for a simple graph with the given `nodeCount`.
142-
The `creationTime` indicates when the graph was created in memory.
143-
The `modificationTime` indicates when the graph was updated by an algorithm running in `mutate` mode.
144-
The `sizeInBytes` yields the number of bytes used in the Java Heap to store that graph.
145-
The `memoryUsage` is the same information in a human readable format.
146187

147-
.List information about the degree distribution of a named graph in the catalog:
188+
189+
=== Examples
190+
191+
.List basic information about all graphs in the catalog:
192+
[source,cypher]
193+
----
194+
CALL gds.graph.list()
195+
YIELD graphName, nodeCount, relationshipCount, schema;
196+
----
197+
198+
.List extended information about a specific named graph in the catalog:
148199
[source,cypher]
149200
----
150201
CALL gds.graph.list('my-cypher-graph')
151-
YIELD graphName, degreeDistribution;
202+
YIELD graphName, nodeQuery, relationshipQuery, nodeCount, relationshipCount, schema, creationTime, modificationTime, memoryUsage;
152203
----
153204

154-
.List information about a named graph in the catalog with all return columns including `degreeDistribution`:
205+
.List all information about a specific named graph in the catalog:
155206
[source,cypher]
156207
----
157208
CALL gds.graph.list('my-native-graph')
158209
----
159210

211+
.List information about the degree distribution of a specific graph:
212+
[source,cypher]
213+
----
214+
CALL gds.graph.list('my-cypher-graph')
215+
YIELD graphName, degreeDistribution;
216+
----
217+
160218

161219
[[catalog-graph-exists]]
162220
== Check if a graph exists in the catalog

0 commit comments

Comments
 (0)