Skip to content

Commit a0efafb

Browse files
committed
Add report with all pairs shortest paths distribution for dependencies
1 parent 1a7a26f commit a0efafb

File tree

6 files changed

+797
-0
lines changed

6 files changed

+797
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Get dependency projection statistics
2+
3+
CALL gds.graph.list($dependencies_projection + '-cleaned')
4+
YIELD nodeCount, relationshipCount, density, sizeInBytes, degreeDistribution
5+
RETURN nodeCount
6+
,relationshipCount
7+
,density
8+
,sizeInBytes
9+
,degreeDistribution.min
10+
,degreeDistribution.mean
11+
,degreeDistribution.max
12+
,degreeDistribution.p50
13+
,degreeDistribution.p75
14+
,degreeDistribution.p90
15+
,degreeDistribution.p95
16+
,degreeDistribution.p99
17+
,degreeDistribution.p999
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Path Finding - All shortest paths algorithm - Stream
2+
3+
CALL gds.allShortestPaths.stream($dependencies_projection + '-cleaned')
4+
YIELD sourceNodeId, targetNodeId, distance
5+
WHERE gds.util.isFinite(distance) = true
6+
WITH gds.util.asNode(sourceNodeId) AS source
7+
,gds.util.asNode(targetNodeId) AS target
8+
,toInteger(distance) AS distance
9+
,sourceNodeId
10+
,targetNodeId
11+
MATCH (project:P)
12+
OPTIONAL MATCH (artifact:Artifact)-[:CONTAINS]->(codeUnit)
13+
WHERE sourceNodeId <> targetNodeId
14+
RETURN distance
15+
,count(*) AS pairCount
16+
,count(DISTINCT sourceNodeId) AS sourceNodeCount
17+
,count(DISTINCT targetNodeId) AS targetNodeCount
18+
,collect(DISTINCT source.fileName + ' ->' + target.fileName)[0..2] AS examples
19+
ORDER BY distance
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Longest paths distribution
2+
3+
CALL gds.dag.longestPath.stream($dependencies_projection + '-cleaned')
4+
YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path
5+
RETURN toInteger(totalCost) AS totalCost
6+
,count(*) AS nodeCount
7+
ORDER BY totalCost
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Example on how to set the parameters for centrality in this case for Packages and PageRank
2+
3+
:params {
4+
"dependencies_projection": "package-path-finding",
5+
"dependencies_projection_node": "Package",
6+
"dependencies_projection_weight_property": "weight25PercentInterfaces",
7+
}

0 commit comments

Comments
 (0)