@@ -113,6 +113,8 @@ detectCommunitiesWithLouvain() {
113113 execute_cypher " ${PROJECTION_CYPHER_DIR} /Dependencies_9_Write_Mutated.cypher" " ${@ } " " ${writePropertyNameIntermediate} "
114114 execute_cypher " ${PROJECTION_CYPHER_DIR} /Dependencies_10_Delete_Label.cypher" " ${@ } " " ${writePropertyName} " " ${writeLabelName} "
115115 execute_cypher " ${PROJECTION_CYPHER_DIR} /Dependencies_11_Add_Label.cypher" " ${@ } " " ${writePropertyName} " " ${writeLabelName} "
116+
117+ queryCommunitiyModularities " ${@ } " " ${writePropertyName} "
116118}
117119
118120# Community Detection using the Leiden Algorithm
@@ -157,19 +159,8 @@ detectCommunitiesWithLeiden() {
157159 execute_cypher " ${PROJECTION_CYPHER_DIR} /Dependencies_9_Write_Mutated.cypher" " ${@ } " " ${writePropertyNameIntermediate} "
158160 execute_cypher " ${PROJECTION_CYPHER_DIR} /Dependencies_10_Delete_Label.cypher" " ${@ } " " ${writePropertyName} " " ${writeLabelName} "
159161 execute_cypher " ${PROJECTION_CYPHER_DIR} /Dependencies_11_Add_Label.cypher" " ${@ } " " ${writePropertyName} " " ${writeLabelName} "
160- }
161162
162- # Write modularity for Leiden communities
163- #
164- # Required Parameters:
165- # - dependencies_projection=...
166- # Name prefix for the in-memory projection name for dependencies. Example: "package"
167- # - dependencies_projection_weight_property=...
168- # Name of the node property that contains the dependency weight. Example: "weight"
169- writeLeidenModularity () {
170- local COMMUNITY_DETECTION_CYPHER_DIR=" ${CYPHER_DIR} /Community_Detection"
171- local writePropertyName=" dependencies_projection_write_property=communityLeidenId"
172- execute_cypher " ${COMMUNITY_DETECTION_CYPHER_DIR} /Community_Detection_7e_Write_Modularity.cypher" " ${@ } " " ${writePropertyName} "
163+ queryCommunitiyModularities " ${@ } " " ${writePropertyName} "
173164}
174165
175166# Community Detection using the Weakly Connected Components Algorithm
@@ -312,6 +303,41 @@ detectCommunitiesWithApproximateMaximumKCut() {
312303 execute_cypher " ${PROJECTION_CYPHER_DIR} /Dependencies_11_Add_Label.cypher" " ${@ } " " ${writePropertyName} " " ${writeLabelName} "
313304}
314305
306+ # Query modularity for Leiden communities
307+ #
308+ # Required Parameters:
309+ # - dependencies_projection=...
310+ # Name prefix for the in-memory projection name for dependencies. Example: "package"
311+ # - writePropertyName=...
312+ # Name of the property that contains the communitiy id
313+ # - dependencies_projection_weight_property=...
314+ # Name of the node property that contains the dependency weight. Example: "weight"
315+ queryCommunitiyModularities () {
316+ local COMMUNITY_DETECTION_CYPHER_DIR=" ${CYPHER_DIR} /Community_Detection"
317+
318+ local nodeLabel
319+ nodeLabel=$( extractQueryParameter " dependencies_projection_node" " ${@ } " )
320+
321+ local propertyName
322+ propertyName=$( extractQueryParameter " dependencies_projection_write_property" " ${@ } " )
323+
324+ # Stream to CSV
325+ execute_cypher " ${COMMUNITY_DETECTION_CYPHER_DIR} /Community_Detection_7d_Modularity_Members.cypher" " ${@ } " > " ${FULL_REPORT_DIRECTORY} /${nodeLabel} _${propertyName} _Communities_Modularities.csv"
326+ }
327+
328+ # Write modularity for Leiden communities
329+ #
330+ # Required Parameters:
331+ # - dependencies_projection=...
332+ # Name prefix for the in-memory projection name for dependencies. Example: "package"
333+ # - dependencies_projection_weight_property=...
334+ # Name of the node property that contains the dependency weight. Example: "weight"
335+ writeLeidenModularity () {
336+ local COMMUNITY_DETECTION_CYPHER_DIR=" ${CYPHER_DIR} /Community_Detection"
337+ local writePropertyName=" dependencies_projection_write_property=communityLeidenId"
338+ execute_cypher " ${COMMUNITY_DETECTION_CYPHER_DIR} /Community_Detection_7e_Write_Modularity.cypher" " ${@ } " " ${writePropertyName} "
339+ }
340+
315341# Compare the results of different community detection algorighms
316342#
317343# Required Parameters:
0 commit comments