Skip to content

Commit c1d468f

Browse files
committed
Add hyper-parameter tuned Leiden community detection
1 parent eba4e42 commit c1d468f

6 files changed

+331
-26
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//Community Detection Leiden Statistics
2+
3+
CALL gds.leiden.stats(
4+
$dependencies_projection + '-cleaned', {
5+
gamma: toFloat($dependencies_leiden_gamma),
6+
theta: toFloat($dependencies_leiden_theta),
7+
maxLevels: toInteger($dependencies_leiden_max_levels),
8+
tolerance: 0.0000001,
9+
consecutiveIds: true,
10+
relationshipWeightProperty: $dependencies_projection_weight_property
11+
})
12+
YIELD nodeCount
13+
,communityCount
14+
,ranLevels
15+
,modularity
16+
,modularities
17+
,communityDistribution
18+
RETURN nodeCount
19+
,communityCount
20+
,ranLevels
21+
,modularity
22+
,modularities
23+
,communityDistribution.min
24+
,communityDistribution.mean
25+
,communityDistribution.max
26+
,communityDistribution.p50
27+
,communityDistribution.p75
28+
,communityDistribution.p90
29+
,communityDistribution.p95
30+
,communityDistribution.p99
31+
,communityDistribution.p999
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//Community Detection Leiden Write property communityLeidenId
2+
3+
CALL gds.leiden.write(
4+
$dependencies_projection + '-cleaned', {
5+
gamma: toFloat($dependencies_leiden_gamma),
6+
theta: toFloat($dependencies_leiden_theta),
7+
maxLevels: toInteger($dependencies_leiden_max_levels),
8+
tolerance: 0.0000001,
9+
consecutiveIds: true,
10+
relationshipWeightProperty: $dependencies_projection_weight_property,
11+
writeProperty: $dependencies_projection_write_property
12+
})
13+
YIELD preProcessingMillis
14+
,computeMillis
15+
,writeMillis
16+
,postProcessingMillis
17+
,nodePropertiesWritten
18+
,communityCount
19+
,ranLevels
20+
,modularity
21+
,modularities
22+
,communityDistribution
23+
RETURN preProcessingMillis
24+
,computeMillis
25+
,writeMillis
26+
,postProcessingMillis
27+
,nodePropertiesWritten
28+
,communityCount
29+
,ranLevels
30+
,modularity
31+
,communityDistribution.min
32+
,communityDistribution.mean
33+
,communityDistribution.max
34+
,communityDistribution.p50
35+
,communityDistribution.p75
36+
,communityDistribution.p90
37+
,communityDistribution.p95
38+
,communityDistribution.p99
39+
,communityDistribution.p999
40+
,modularities

cypher/Node_Embeddings/Node_Embeddings_1d_Fast_Random_Projection_Tuneable_Stream.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ OPTIONAL MATCH (projectRoot:Directory)<-[:HAS_ROOT]-(proj:TS:Project)-[:CONTAINS
2121
,codeUnit.name AS shortCodeUnitName
2222
,elementId(codeUnit) AS nodeElementId
2323
,coalesce(artifactName, projectName) AS projectName
24-
,coalesce(codeUnit.communityLeidenId, 0) AS communityId
24+
,coalesce(codeUnit.communityLeidenIdTuned, codeUnit.communityLeidenId, 0) AS communityId
2525
,coalesce(codeUnit.centralityPageRank, 0.01) AS centrality
2626
,embedding

cypher/Node_Embeddings/Node_Embeddings_2d_Hash_GNN_Tuneable_Stream.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ OPTIONAL MATCH (projectRoot:Directory)<-[:HAS_ROOT]-(proj:TS:Project)-[:CONTAINS
2525
,codeUnit.name AS shortCodeUnitName
2626
,elementId(codeUnit) AS nodeElementId
2727
,coalesce(artifactName, projectName) AS projectName
28-
,coalesce(codeUnit.communityLeidenId, 0) AS communityId
28+
,coalesce(codeUnit.communityLeidenIdTuned, codeUnit.communityLeidenId, 0) AS communityId
2929
,coalesce(codeUnit.centralityPageRank, 0.01) AS centrality
3030
,embedding

cypher/Node_Embeddings/Node_Embeddings_3d_Node2Vec_Tuneable_Stream.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ OPTIONAL MATCH (projectRoot:Directory)<-[:HAS_ROOT]-(proj:TS:Project)-[:CONTAINS
2727
,codeUnit.name AS shortCodeUnitName
2828
,elementId(codeUnit) AS nodeElementId
2929
,coalesce(artifactName, projectName) AS projectName
30-
,coalesce(codeUnit.communityLeidenId, 0) AS communityId
30+
,coalesce(codeUnit.communityLeidenIdTuned, codeUnit.communityLeidenId, 0) AS communityId
3131
,coalesce(codeUnit.centralityPageRank, 0.01) AS centrality
3232
,embedding

0 commit comments

Comments
 (0)