Skip to content

Commit 9142905

Browse files
committed
Optimize Bridges centrality output and run it for Java Types
1 parent 7fae849 commit 9142905

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

cypher/Centrality/Centrality_10d_Bridges_Stream.cypher

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ CALL gds.bridges.stream($dependencies_projection + '-cleaned')
44
YIELD from, to
55
WITH gds.util.asNode(from) AS fromMember
66
,gds.util.asNode(to) AS toMember
7-
WITH *
8-
,toMember.rootProjectName + '/' + toMember.name AS toMemberNameWithRoot
9-
,fromMember.rootProjectName + '/' + fromMember.name AS fromMemberNameWithRoot
10-
RETURN coalesce(fromMember.fqn, fromMemberNameWithRoot, fromMember.name, fromMember.fileName) AS fromMemberName
11-
,coalesce(toMember.fqn, toMemberNameWithRoot, toMember.name, toMember.fileName) AS toMemberName
7+
OPTIONAL MATCH (fromType:Type)-[:DECLARES]->(fromMember)
8+
WITH *, coalesce(fromType.fqn + ': ', '') +
9+
coalesce(fromMember.rootProjectName + '/', '') +
10+
coalesce(fromMember.signature, fromMember.name) AS fromMemberNameWithDetails
11+
OPTIONAL MATCH (toType:Type)-[:DECLARES]->(toMember)
12+
WITH *, coalesce(toType.fqn + ': ', '') +
13+
coalesce(toMember.rootProjectName + '/', '') +
14+
coalesce(toMember.signature, toMember.name) AS toMemberNameWithDetails
15+
RETURN coalesce(fromMember.fqn, fromMemberNameWithDetails, fromMember.fileName, fromMember.name) AS fromMemberName
16+
,coalesce(toMember.fqn, toMemberNameWithDetails, toMember.fileName, toMember.name) AS toMemberName
1217
,fromMember.incomingDependencies AS fromIncomingDependencies
1318
,fromMember.outgoingDependencies AS fromOutgoingDependencies
1419
,toMember.incomingDependencies AS toIncomingDependencies

scripts/reports/CentralityCsv.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ runUndirectedCentralityAlgorithms() {
375375
# -- Java Artifact Centrality ------------------------------------
376376

377377
ARTIFACT_PROJECTION="dependencies_projection=artifact-centrality"
378-
ARTIFACT_PROJECTION_UNDIRECTED="dependencies_projection=${ARTIFACT_PROJECTION}-undirected"
378+
ARTIFACT_PROJECTION_UNDIRECTED="dependencies_projection=artifact-centrality-undirected"
379379
ARTIFACT_NODE="dependencies_projection_node=Artifact"
380380
ARTIFACT_WEIGHT="dependencies_projection_weight_property=weight"
381381

@@ -389,7 +389,7 @@ fi
389389
# -- Java Package Centrality -------------------------------------
390390

391391
PACKAGE_PROJECTION="dependencies_projection=package-centrality"
392-
PACKAGE_PROJECTION_UNDIRECTED="dependencies_projection=${PACKAGE_PROJECTION}-undirected"
392+
PACKAGE_PROJECTION_UNDIRECTED="dependencies_projection=package-centrality-undirected"
393393
PACKAGE_NODE="dependencies_projection_node=Package"
394394
PACKAGE_WEIGHT="dependencies_projection_weight_property=weight25PercentInterfaces"
395395

@@ -402,17 +402,21 @@ fi
402402

403403
# -- Java Type Centrality ----------------------------------------
404404

405-
TYPE_PROJECTION="dependencies_projection=type-centrality"
405+
TYPE_PROJECTION="dependencies_projection=type-centrality"
406+
TYPE_PROJECTION_UNDIRECTED="dependencies_projection=type-centrality-undirected"
406407
TYPE_NODE="dependencies_projection_node=Type"
407408
TYPE_WEIGHT="dependencies_projection_weight_property=weight"
408409

409410
if createDirectedJavaTypeDependencyProjection "${TYPE_PROJECTION}" "${TYPE_NODE}" "${TYPE_WEIGHT}"; then
410411
runCentralityAlgorithms "${TYPE_PROJECTION}" "${TYPE_NODE}" "${TYPE_WEIGHT}"
411412
fi
413+
if createUndirectedJavaTypeDependencyProjection "${TYPE_PROJECTION_UNDIRECTED}"; then
414+
runUndirectedCentralityAlgorithms "${TYPE_PROJECTION_UNDIRECTED}" "${TYPE_NODE}"
415+
fi
412416

413417
# -- Java Method Centrality --------------------------------------
414418

415-
METHOD_PROJECTION="dependencies_projection=method-centrality"
419+
METHOD_PROJECTION="dependencies_projection=method-centrality"
416420
METHOD_NODE="dependencies_projection_node=Method"
417421
METHOD_WEIGHT="dependencies_projection_weight_property="
418422

@@ -424,7 +428,7 @@ fi
424428

425429
MODULE_LANGUAGE="dependencies_projection_language=Typescript"
426430
MODULE_PROJECTION="dependencies_projection=typescript-module-centrality"
427-
MODULE_PROJECTION_UNDIRECTED="dependencies_projection=${MODULE_PROJECTION}-undirected"
431+
MODULE_PROJECTION_UNDIRECTED="dependencies_projection=typescript-module-centrality-undirected"
428432
MODULE_NODE="dependencies_projection_node=Module"
429433
MODULE_WEIGHT="dependencies_projection_weight_property=lowCouplingElement25PercentWeight"
430434

0 commit comments

Comments
 (0)