Skip to content

Commit b9c25aa

Browse files
authored
Merge pull request #534 from JohT/feature/add-strongly-connected-components-community-detection
Add strongly connected components community detection
2 parents 5f2f9a2 + 4099946 commit b9c25aa

12 files changed

Lines changed: 209 additions & 28 deletions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Community Detection Strongly Connected Components Estimate
2+
3+
CALL gds.scc.write.estimate(
4+
$dependencies_projection + '-cleaned', {
5+
writeProperty: $dependencies_projection_write_property
6+
,consecutiveIds: true
7+
})
8+
YIELD requiredMemory
9+
,nodeCount
10+
,relationshipCount
11+
,bytesMin
12+
,bytesMax
13+
,heapPercentageMin
14+
,heapPercentageMax
15+
,treeView
16+
,mapView
17+
RETURN requiredMemory
18+
,nodeCount
19+
,relationshipCount
20+
,bytesMin
21+
,bytesMax
22+
,heapPercentageMin
23+
,heapPercentageMax
24+
,treeView
25+
//,mapView //doesn't work on Windows with git bash jq version jq-1.7-dirty

cypher/Community_Detection/Community_Detection_3a_WeaklyConnectedComponents_Estimate.cypher

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// Community Detection Label Propagation Estimate
1+
// Community Detection Weakly Connected Components
22

3-
CALL gds.labelPropagation.write.estimate(
3+
CALL gds.wcc.write.estimate(
44
$dependencies_projection + '-cleaned', {
5-
relationshipWeightProperty: $dependencies_projection_weight_property
6-
,writeProperty: $dependencies_projection_write_property
5+
writeProperty: $dependencies_projection_write_property
76
,consecutiveIds: true
87
})
98
YIELD requiredMemory
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Community Detection Strongly Connected Components Statistics
2+
3+
CALL gds.scc.stats(
4+
$dependencies_projection + '-cleaned', {
5+
consecutiveIds: true
6+
})
7+
YIELD componentCount
8+
,preProcessingMillis
9+
,computeMillis
10+
,postProcessingMillis
11+
,componentDistribution
12+
RETURN componentCount
13+
,preProcessingMillis
14+
,computeMillis
15+
,postProcessingMillis
16+
,componentDistribution.min
17+
,componentDistribution.mean
18+
,componentDistribution.max
19+
,componentDistribution.p50
20+
,componentDistribution.p75
21+
,componentDistribution.p90
22+
,componentDistribution.p95
23+
,componentDistribution.p99
24+
,componentDistribution.p999

cypher/Community_Detection/Community_Detection_3b_WeaklyConnectedComponents_Statistics.cypher

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
CALL gds.wcc.stats(
44
$dependencies_projection + '-cleaned', {
5-
relationshipWeightProperty: $dependencies_projection_weight_property
6-
,consecutiveIds: true
5+
consecutiveIds: true
76
})
87
YIELD componentCount
98
,preProcessingMillis
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Community Detection Strongly Connected Components Mutate
2+
3+
CALL gds.scc.mutate(
4+
$dependencies_projection + '-cleaned', {
5+
mutateProperty: $dependencies_projection_write_property
6+
,consecutiveIds: true
7+
})
8+
YIELD componentCount
9+
,nodePropertiesWritten
10+
,preProcessingMillis
11+
,computeMillis
12+
,mutateMillis
13+
,postProcessingMillis
14+
,componentDistribution
15+
RETURN componentCount
16+
,nodePropertiesWritten
17+
,preProcessingMillis
18+
,computeMillis
19+
,mutateMillis
20+
,postProcessingMillis
21+
,componentDistribution.min
22+
,componentDistribution.mean
23+
,componentDistribution.max
24+
,componentDistribution.p50
25+
,componentDistribution.p75
26+
,componentDistribution.p90
27+
,componentDistribution.p95
28+
,componentDistribution.p99
29+
,componentDistribution.p999

cypher/Community_Detection/Community_Detection_3c_WeaklyConnectedComponents_Mutate.cypher

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
CALL gds.wcc.mutate(
44
$dependencies_projection + '-cleaned', {
5-
relationshipWeightProperty: $dependencies_projection_weight_property
6-
,mutateProperty: $dependencies_projection_write_property
5+
mutateProperty: $dependencies_projection_write_property
76
,consecutiveIds: true
87
})
98
YIELD componentCount
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Community Detection Strongly Connected Components Stream
2+
3+
CALL gds.scc.stream(
4+
$dependencies_projection + '-cleaned', {
5+
consecutiveIds: true
6+
})
7+
YIELD nodeId, componentId
8+
WITH componentId
9+
,gds.util.asNode(nodeId) AS member
10+
WITH componentId
11+
,member
12+
,coalesce(member.fqn, member.fileName, member.name) AS memberName
13+
WITH componentId
14+
,count(DISTINCT member) AS memberCount
15+
,collect(DISTINCT memberName) AS memberNames
16+
RETURN componentId
17+
,memberCount
18+
,memberNames
19+
ORDER BY memberCount DESC, componentId ASC

cypher/Community_Detection/Community_Detection_3d_WeaklyConnectedComponents_Stream.cypher

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
CALL gds.wcc.stream(
44
$dependencies_projection + '-cleaned', {
5-
relationshipWeightProperty: $dependencies_projection_weight_property,
6-
consecutiveIds: true
5+
consecutiveIds: true
76
})
87
YIELD nodeId, componentId
98
WITH componentId
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Community Detection Strongly Connected Components write node property communityStronglyConnectedComponentId
2+
3+
CALL gds.scc.write(
4+
$dependencies_projection + '-cleaned', {
5+
consecutiveIds: true
6+
,writeProperty: 'communityStronglyConnectedComponentId'
7+
})
8+
YIELD componentCount
9+
,preProcessingMillis
10+
,computeMillis
11+
,writeMillis
12+
,postProcessingMillis
13+
,nodePropertiesWritten
14+
,componentDistribution
15+
RETURN componentCount
16+
,preProcessingMillis
17+
,computeMillis
18+
,writeMillis
19+
,postProcessingMillis
20+
,nodePropertiesWritten
21+
,componentDistribution.min
22+
,componentDistribution.mean
23+
,componentDistribution.max
24+
,componentDistribution.p50
25+
,componentDistribution.p75
26+
,componentDistribution.p90
27+
,componentDistribution.p95
28+
,componentDistribution.p99
29+
,componentDistribution.p999

cypher/Community_Detection/Community_Detection_3e_WeaklyConnectedComponents_Write.cypher

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
CALL gds.wcc.write(
44
$dependencies_projection + '-cleaned', {
5-
relationshipWeightProperty: $dependencies_projection_weight_property
6-
,consecutiveIds: true
5+
consecutiveIds: true
76
,writeProperty: 'communityWeaklyConnectedComponentId'
87
})
98
YIELD componentCount

0 commit comments

Comments
 (0)