Skip to content

Commit 703a85b

Browse files
committed
Add community metric conductance
1 parent 815909a commit 703a85b

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Community Detection Conductance
2+
3+
CALL gds.conductance.stream(
4+
$dependencies_projection + '-cleaned', {
5+
relationshipWeightProperty: $dependencies_projection_weight_property
6+
,communityProperty: $dependencies_projection_write_property
7+
})
8+
YIELD community, conductance
9+
RETURN community, conductance
10+
ORDER BY community ASCENDING
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Community Detection Conductance Members
2+
3+
CALL gds.conductance.stream(
4+
$dependencies_projection + '-cleaned', {
5+
relationshipWeightProperty: $dependencies_projection_weight_property
6+
,communityProperty: $dependencies_projection_write_property
7+
})
8+
YIELD community AS communityId, conductance
9+
WITH collect({communityId: communityId, conductance: conductance}) AS communityMetrics
10+
MATCH (member)
11+
WHERE member[$dependencies_projection_write_property] IS NOT NULL
12+
AND $dependencies_projection_node IN LABELS(member)
13+
WITH communityMetrics
14+
,member[$dependencies_projection_write_property] AS communityId
15+
,coalesce(member.fqn, member.fileName, member.name) AS memberName
16+
,coalesce(member.name, replace(last(split(member.fileName, '/')), '.jar', '')) AS shortMemberName
17+
WITH communityMetrics
18+
,communityId
19+
,count(DISTINCT memberName) AS memberCount
20+
,collect(DISTINCT shortMemberName) AS shortMemberNames
21+
,collect(DISTINCT memberName) AS memberNames
22+
,reduce(memberConductance = 0, conductance IN communityMetrics |
23+
CASE conductance.communityId WHEN communityId THEN conductance.conductance
24+
ELSE memberConductance END) AS conductance
25+
RETURN communityId
26+
,conductance
27+
,memberCount
28+
,shortMemberNames[0..9] AS someMemberNamesShort
29+
,memberNames[0..9] AS someMemberNames
30+
ORDER BY communityId ASCENDING

0 commit comments

Comments
 (0)