-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommunity_Detection_8d_Conductance_Members.cypher
30 lines (29 loc) · 1.43 KB
/
Community_Detection_8d_Conductance_Members.cypher
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Community Detection Conductance Members. Requires "Add_file_name and_extension.cypher".
CALL gds.conductance.stream(
$dependencies_projection + '-cleaned', {
relationshipWeightProperty: $dependencies_projection_weight_property
,communityProperty: $dependencies_projection_write_property
})
YIELD community AS communityId, conductance
WITH collect({communityId: communityId, conductance: conductance}) AS communityMetrics
MATCH (member)
WHERE member[$dependencies_projection_write_property] IS NOT NULL
AND $dependencies_projection_node IN LABELS(member)
WITH communityMetrics
,member[$dependencies_projection_write_property] AS communityId
,coalesce(member.fqn, member.fileName, member.name) AS memberName
,member.name AS shortMemberName
WITH communityMetrics
,communityId
,count(DISTINCT memberName) AS memberCount
,collect(DISTINCT shortMemberName) AS shortMemberNames
,collect(DISTINCT memberName) AS memberNames
,reduce(memberConductance = 0, conductance IN communityMetrics |
CASE conductance.communityId WHEN communityId THEN conductance.conductance
ELSE memberConductance END) AS conductance
RETURN communityId
,conductance
,memberCount
,shortMemberNames[0..9] AS someMemberNamesShort
,memberNames[0..9] AS someMemberNames
ORDER BY communityId ASCENDING