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
A clique is a subset of nodes where all nodes are connected to each other, sometimes called a complete subgraph. The clique counting algorithm counts the number of cliques of various sizes in the graph. In GDS this is done efficiently, without realizing every clique, through a Succinct Clique Tree-structure, see https://dl.acm.org/doi/pdf/10.1145/3336191.3371839[The Power of Pivoting for Exact Clique Counting]
15
+
A clique is a subset of nodes where all nodes are connected to each other, sometimes called a complete subgraph. The clique counting algorithm counts the number of cliques of various sizes in the graph. In GDS this is done efficiently, without realizing every clique, through a Succinct Clique Tree-structure, see https://dl.acm.org/doi/pdf/10.1145/3336191.3371839[The Power of Pivoting for Exact Clique Counting].
16
16
17
17
Counting the number of cliques in the graph, can give an understanding for the topology and clustering of the graph in its entirety as well as for individual nodes. The algorithm counts only cliques of size 3 or larger, since cliques of sizes 1 and 2 are trivial (nodes and relationships, respectively). If you are only interested in triangles (cliques of size 3), the xref:algorithms/triangle-count.adoc[Triangle Count] is a better choice.
RETURN gds.util.asNode(nodeId).name AS name, perNodeCount
253
+
YIELD nodeId, counts
254
+
RETURN gds.util.asNode(nodeId).name AS name, counts
255
+
ORDER BY name ASC
266
256
----
267
-
// ORDER BY triangleCount DESC, name ASC //fixme
268
-
//todo: Test this
269
257
.Results
270
258
[opts="header",cols="1,1"]
271
259
|===
272
-
| name | perNodeCount
273
-
| "Chris" | [4,1]
274
-
| "Karin" | [4,1]
275
-
| "Alice" | [3,1]
276
-
| "Michael" | [3,1]
260
+
| name | counts
261
+
| "Alice" | [3, 1]
262
+
| "Chris" | [4, 1]
263
+
| "Karin" | [4, 1]
264
+
| "Mark" | []
265
+
| "Michael" | [3, 1]
277
266
| "Will" | [1]
278
-
| "Mark" | [ ]
279
267
|===
280
268
--
281
-
Here we find that the 'Chris' node is part of 4 triangles and a four-clique, while the 'Will' node is part of only a triangle. This can be verified in the xref:algorithms/clique-counting.adoc#algorithms-clique-counting-examples[example graph]. Since the 'Dan' node is linked only to Bob, it is not part of any clique of size three or larger and we therefore get an empty list.
269
+
Here we find that the 'Chris' node is part of 4 triangles and a four-clique, while the 'Will' node is part of only a triangle. This can be verified in the xref:algorithms/clique-counting.adoc#algorithms-clique-counting-examples[example graph]. Since the 'Mark' node is linked only to the 'Will' node, it is not part of any clique of size three or larger and we therefore get an empty list.
282
270
283
271
Note that with a clique of size k, you are guaranteed to have a clique also of size k-1 since any subset of a clique is also a clique.
@@ -317,7 +304,6 @@ In other words, that node is part of most cliques in the graph and thus has a ve
317
304
[[algorithms-clique-counting-examples-mutate]]
318
305
=== Mutate
319
306
320
-
// :mutate-details: For example, using the clique counting to compute the xref:algorithms/local-clustering-coefficient.adoc#algorithms-local-clustering-coefficient-examples-pre-computed[local clustering coefficient].
Copy file name to clipboardExpand all lines: procedures/facade-api/community-facade-api/src/main/java/org/neo4j/gds/procedures/algorithms/community/CliqueCountingMutateResult.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ public record CliqueCountingMutateResult(
Copy file name to clipboardExpand all lines: procedures/facade-api/community-facade-api/src/main/java/org/neo4j/gds/procedures/algorithms/community/CliqueCountingStatsResult.java
-3Lines changed: 0 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,6 @@
30
30
publicrecordCliqueCountingStatsResult(
31
31
longpreProcessingMillis,
32
32
longcomputeMillis,
33
-
longnodeCount,
34
33
List<Long> globalCount,
35
34
Map<String, Object> configuration
36
35
) implementsModeResult {
@@ -45,7 +44,6 @@ public static CliqueCountingStatsResult create(
Copy file name to clipboardExpand all lines: procedures/facade-api/community-facade-api/src/main/java/org/neo4j/gds/procedures/algorithms/community/CliqueCountingWriteResult.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -30,22 +30,22 @@ public record CliqueCountingWriteResult(
0 commit comments