|
1 |
| -:page-aliases: algorithms/all-pairs-shortest-path.adoc |
2 |
| - |
3 | 1 | [[algorithm-all-pairs-shortest-path]]
|
4 | 2 | = All Pairs Shortest Path
|
5 | 3 | :description: This section describes the All Pairs Shortest Path algorithm in the Neo4j Graph Data Science library.
|
@@ -77,45 +75,6 @@ include::partial$/algorithms/common-configuration/common-stream-stats-configurat
|
77 | 75 |
|
78 | 76 | ======
|
79 | 77 |
|
80 |
| -[.include-with-estimate] |
81 |
| -====== |
82 |
| -.The following will estimate the memory requirements for running the algorithm: |
83 |
| -[source, cypher, role=noplay] |
84 |
| ----- |
85 |
| -CALL gds.allShortestPaths.stream.estimate( |
86 |
| - graphNameOrConfiguration: string or map, |
87 |
| - configuration: map |
88 |
| -) |
89 |
| -YIELD nodeCount, relationshipCount, bytesMin, bytesMax, requiredMemory |
90 |
| ----- |
91 |
| -
|
92 |
| -include::partial$/algorithms/common-configuration/common-parameters.adoc[] |
93 |
| -
|
94 |
| -.Configuration |
95 |
| -[opts="header",cols="3,2,3m,2,8"] |
96 |
| -|=== |
97 |
| -| Name | Type | Default | Optional | Description |
98 |
| -include::partial$/algorithms/common-configuration/common-estimate-configuration-entries.adoc[] |
99 |
| -| xref:common-usage/running-algos.adoc#common-configuration-relationship-weight-property[relationshipWeightProperty] | String | null | yes | Name of the relationship property to use as weights. If unspecified, the algorithm runs unweighted. |
100 |
| -|=== |
101 |
| -
|
102 |
| -.Results |
103 |
| -[opts="header",cols="1,1,6"] |
104 |
| -|=== |
105 |
| -| Name | Type | Description |
106 |
| -| nodeCount | Integer | The number of nodes in the graph. |
107 |
| -| relationshipCount | Integer | The number of relationships in the graph. |
108 |
| -| requiredMemory | String | An estimation of the required memory in a human readable format. |
109 |
| -| treeView | String | A more detailed representation of the required memory, including estimates of the different components in human readable format. |
110 |
| -| mapView | Map | A more detailed representation of the required memory, including estimates of the different components in structured format. |
111 |
| -| bytesMin | Integer | The minimum number of bytes required. |
112 |
| -| bytesMax | Integer | The maximum number of bytes required. |
113 |
| -| heapPercentageMin | Float | The minimum percentage of the configured maximum heap required. |
114 |
| -| heapPercentageMax | Float | The maximum percentage of the configured maximum heap required. |
115 |
| -|=== |
116 |
| -
|
117 |
| -====== |
118 |
| - |
119 | 78 | [[algorithm-all-pairs-shortest-path-sample]]
|
120 | 79 | == All Pairs Shortest Path algorithm sample
|
121 | 80 |
|
@@ -158,6 +117,39 @@ RETURN gds.graph.project(
|
158 | 117 | )
|
159 | 118 | ----
|
160 | 119 |
|
| 120 | +[[algorithm-all-pairs-shortest-path-examples-memory-estimation]] |
| 121 | +=== Memory Estimation |
| 122 | + |
| 123 | +:mode: stream |
| 124 | +include::partial$/algorithms/shared/examples-estimate-intro.adoc[] |
| 125 | + |
| 126 | +[role=query-example] |
| 127 | +-- |
| 128 | +.The following will estimate the memory requirements for running the algorithm: |
| 129 | +[source, cypher, role=noplay] |
| 130 | +---- |
| 131 | +CALL gds.allShortestPaths.stream.estimate('cypherGraph', { |
| 132 | + relationshipWeightProperty: 'cost' |
| 133 | +}) |
| 134 | +YIELD nodeCount, relationshipCount, bytesMin, bytesMax, requiredMemory |
| 135 | +RETURN nodeCount, relationshipCount, bytesMin, bytesMax, requiredMemory |
| 136 | +---- |
| 137 | + |
| 138 | +.Results |
| 139 | +[opts="header"] |
| 140 | +|=== |
| 141 | +| nodeCount | relationshipCount | bytesMin | bytesMax | requiredMemory |
| 142 | +| 6 | 18 | 1264 | 1264 | "1264 Bytes" |
| 143 | +|=== |
| 144 | +-- |
| 145 | + |
| 146 | +[[algorithm-all-pairs-shortest-path-examples-stream]] |
| 147 | +=== Stream |
| 148 | + |
| 149 | +:!stream-details: |
| 150 | +In the `stream` execution mode, the algorithm returns the shortest path distance for each source-target pair. |
| 151 | +This allows us to inspect the results directly or post-process them in Cypher without any side effects. |
| 152 | + |
161 | 153 | [role=query-example]
|
162 | 154 | --
|
163 | 155 | .The following will run the algorithm, treating the graph as undirected:
|
|
0 commit comments