Skip to content

Commit 698fe57

Browse files
Mats-SXvnickolov
andcommitted
Add side-by-side examples for stream and write mode
Co-authored-by: Veselin Nikolov <[email protected]>
1 parent 26ed30a commit 698fe57

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed

doc/asciidoc/migration/migration-triangle-count.adoc

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The `alpha` procedures from the namespace `algo.triangleCount` are being replace
99
Everything relating to clustering coefficients has been extracted into a separate algorithm backing `gds.localClusteringCoefficient` procedures.
1010
To compute both triangle count and local clustering coefficient values multiple procedures will be necessary.
1111

12+
The triangle enumeration procedure `algo.triangles.stream()` has been renamed to `gds.alpha.triangles()`.
1213

1314
.Common changes in Configuration
1415
[opts=header]
@@ -43,3 +44,138 @@ To compute both triangle count and local clustering coefficient values multiple
4344
|===
4445

4546

47+
.TriangleCount Stream Mode
48+
[opts=header,cols="1a,1a"]
49+
|===
50+
|Graph Algorithms v3.5 |Graph Data Science v1.2
51+
52+
2+| Streaming triangle counts over named graph:
53+
|
54+
[source, cypher]
55+
----
56+
CALL algo.triangleCount.stream(null, null, {graph: 'myGraph'})
57+
YIELD nodeId, triangles
58+
----
59+
|
60+
[source, cypher]
61+
----
62+
CALL gds.triangleCount.stream('myGraph')
63+
YIELD nodeId, triangleCount
64+
----
65+
66+
2+| Streaming local clustering coefficients over named graph:
67+
|
68+
[source, cypher]
69+
----
70+
CALL algo.triangleCount.stream(null, null, {graph: 'myGraph'})
71+
YIELD nodeId, coefficient
72+
----
73+
|
74+
[source, cypher]
75+
----
76+
CALL gds.localClusteringCoefficient.stream('myGraph')
77+
YIELD nodeId, localClusteringCoefficient
78+
----
79+
80+
2+| Streaming both triangle counts and local clustering coefficients:
81+
|
82+
[source, cypher]
83+
----
84+
CALL algo.triangleCount.stream(null, null, {graph: 'myGraph'})
85+
YIELD nodeId, triangles, coefficient
86+
----
87+
|
88+
[source, cypher]
89+
----
90+
CALL gds.triangleCount.mutate('myGraph', {mutateProperty: 'tc'})
91+
YIELD globalTriangleCount
92+
CALL gds.localClusteringCoefficient.stream('myGraph', {triangleCountProperty: 'tc'})
93+
YIELD nodeId, localClusteringCoefficient
94+
WITH nodeId, localClusteringCoefficient, gds.util.nodeProperty('myGraph', nodeId, 'tc') AS triangleCount
95+
RETURN nodeId, triangleCount, localClusteringCoefficient
96+
----
97+
98+
2+| Streaming triangle counts over anonymous graph:
99+
|
100+
[source, cypher]
101+
----
102+
CALL algo.triangleCount.stream(
103+
'MyLabel',
104+
'MY_RELATIONSHIP_TYPE'
105+
)
106+
----
107+
|
108+
[source, cypher]
109+
----
110+
CALL gds.triangleCount.stream({
111+
nodeProjection: 'MyLabel',
112+
relationshipProjection: { MY_RELATIONSHIP_TYPE: { orientation: 'UNDIRECTED' } }
113+
})
114+
----
115+
|===
116+
117+
.TriangleCount Write Mode
118+
[opts=header,cols="1a,1a"]
119+
|===
120+
|Graph Algorithms v3.5 |Graph Data Science v1.2
121+
122+
2+| Writing triangle counts from named graph:
123+
|
124+
[source, cypher]
125+
----
126+
CALL algo.triangleCount(null, null, {
127+
graph: 'myGraph',
128+
write: true,
129+
writeProperty: 'tc'
130+
}) YIELD nodeCount, triangleCount
131+
----
132+
|
133+
[source, cypher]
134+
----
135+
CALL gds.triangleCount.write('myGraph', {writeProperty: 'tc'})
136+
YIELD nodeCount, globalTriangleCount
137+
----
138+
139+
2+| Writing local clustering coefficients from named graph:
140+
|
141+
[source, cypher]
142+
----
143+
CALL algo.triangleCount(null, null, {
144+
graph: 'myGraph',
145+
write: true,
146+
clusteringCoefficientProperty: 'lcc'
147+
}) YIELD nodeCount, averageClusteringCoefficient
148+
----
149+
|
150+
[source, cypher]
151+
----
152+
CALL gds.localClusteringCoefficient.write('myGraph', {writeProperty: 'lcc'})
153+
YIELD nodeCount, averageClusteringCoefficient
154+
----
155+
156+
2+| Writing both triangle counts and local clustering coefficients:
157+
|
158+
[source, cypher]
159+
----
160+
CALL algo.triangleCount(null, null, {
161+
graph: 'myGraph',
162+
write: true,
163+
writeProperty: 'tc',
164+
clusteringCoefficientProperty: 'lcc'
165+
}) YIELD nodeCount, triangleCount, averageClusteringCoefficient
166+
----
167+
|
168+
[source, cypher]
169+
----
170+
CALL gds.triangleCount.mutate('myGraph', {
171+
mutateProperty: 'tc'
172+
}) YIELD globalTriangleCount
173+
CALL gds.localClusteringCoefficient.write('myGraph', {
174+
triangleCountProperty: 'tc', writeProperty: 'lcc'
175+
}) YIELD nodeCount, averageClusteringCoefficient
176+
CALL gds.graph.writeNodeProperties('myGraph', ['tc'])
177+
YIELD propertiesWritten
178+
RETURN nodeCount, globalTriangleCount, averageClusteringCoefficient
179+
----
180+
181+
|===

0 commit comments

Comments
 (0)