Skip to content

Commit 41f4ea0

Browse files
authored
Merge pull request #174 from JohT/feature/graph-metrics-report
Add Overview reports
2 parents 5701c6e + 55aa58e commit 41f4ea0

27 files changed

+1452
-14
lines changed

COMMANDS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ Use [importGitLog.sh](./scripts/importGitLog.sh) to import git log data into the
233233
It uses `git log` to extract commits, their authors and the names of the files changed with them. These are stored in an intermediate CSV file and are then imported into Neo4j with the following schema:
234234

235235
```Cypher
236-
(Git:Log:Author)-[:AUTHORED]->(Git:Log:Commit)->[:CONTAINS]->(Git:Log:File)
236+
(Git:Log:Author)-[:AUTHORED]->(Git:Log:Commit)->[:CONTAINS_CHANGED]->(Git:Log:File)
237237
(Git:Log:Commit)->[:HAS_PARENT]-(Git:Log:Commit)
238238
```
239239

@@ -254,7 +254,7 @@ You can use [List_unresolved_git_files.cypher](./cypher/GitLog/List_unresolved_g
254254
Use [importAggregatedGitLog.sh](./scripts/importAggregatedGitLog.sh) to import git log data in an aggregated form into the Graph. It works similar to the [full git log version above](#import-git-log). The only difference is that not every single commit is imported. Instead, changes are grouped per month including their commit count. This is in many cases sufficient and reduces data size and processing time significantly. Here is the resulting schema:
255255

256256
```Cypher
257-
(Git:Log:Author)-[:AUTHORED]->(Git:Log:ChangeSpan)-[:CONTAINS]->(Git:Log:File)
257+
(Git:Log:Author)-[:AUTHORED]->(Git:Log:ChangeSpan)-[:CONTAINS_CHANGED]->(Git:Log:File)
258258
```
259259

260260
## Database Queries

cypher/Centrality/Centrality_1c_Label_Delete.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Centrality Label Delete
22

33
CALL db.labels() YIELD label
4-
WHERE label = 'Top' + apoc.text.capitalize($dependencies_projection_write_property)
4+
WHERE label = 'Mark4Top' + apoc.text.capitalize($dependencies_projection_write_property)
55
WITH collect(label) AS selectedLabels
66
MATCH (member)
77
WHERE $dependencies_projection_node IN LABELS(member)

cypher/Centrality/Centrality_1d_Label_Add.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ UNWIND members AS member
1010
ORDER BY member[$dependencies_projection_write_property] DESCENDING
1111
WITH memberCount2Percent
1212
,collect(DISTINCT member)[0..memberCount2Percent] AS topMembers
13-
,'Top' + apoc.text.capitalize($dependencies_projection_write_property) AS labelName
13+
,'Mark4Top' + apoc.text.capitalize($dependencies_projection_write_property) AS labelName
1414
UNWIND topMembers AS topMember
1515
CALL apoc.create.addLabels(topMember, [labelName]) YIELD node
1616
RETURN count(node) AS nodesCount
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Community Detection - Local Clustering Coefficient - Estimate
2+
3+
CALL gds.localClusteringCoefficient.write.estimate(
4+
$dependencies_projection + '-cleaned', {
5+
writeProperty: $dependencies_projection_write_property
6+
})
7+
YIELD requiredMemory
8+
,nodeCount
9+
,relationshipCount
10+
,bytesMin
11+
,bytesMax
12+
,heapPercentageMin
13+
,heapPercentageMax
14+
,treeView
15+
,mapView
16+
RETURN requiredMemory
17+
,nodeCount
18+
,relationshipCount
19+
,bytesMin
20+
,bytesMax
21+
,heapPercentageMin
22+
,heapPercentageMax
23+
,treeView
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Community Detection - Local Clustering Coefficient - Statistics
2+
3+
CALL gds.localClusteringCoefficient.stats(
4+
$dependencies_projection + '-cleaned', {
5+
})
6+
YIELD averageClusteringCoefficient, nodeCount, preProcessingMillis, computeMillis, postProcessingMillis
7+
RETURN averageClusteringCoefficient, nodeCount, preProcessingMillis, computeMillis, postProcessingMillis
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Community Detection - Local Clustering Coefficient - Mutate
2+
3+
CALL gds.localClusteringCoefficient.mutate(
4+
$dependencies_projection + '-cleaned', {
5+
mutateProperty: $dependencies_projection_write_property
6+
})
7+
YIELD averageClusteringCoefficient, nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, mutateMillis
8+
RETURN averageClusteringCoefficient, nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, mutateMillis
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Community Detection - Local Clustering Coefficient - Stream
2+
3+
CALL gds.localClusteringCoefficient.stream(
4+
$dependencies_projection + '-cleaned', {
5+
})
6+
YIELD nodeId, localClusteringCoefficient
7+
WITH gds.util.asNode(nodeId) AS member
8+
,localClusteringCoefficient
9+
WITH coalesce(member.fqn, member.fileName, member.name) AS memberName
10+
,localClusteringCoefficient
11+
RETURN localClusteringCoefficient
12+
,memberName
13+
ORDER BY localClusteringCoefficient DESC, memberName ASC
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Community Detection - Local Clustering Coefficient - Stream Aggregated
2+
3+
CALL gds.localClusteringCoefficient.stream(
4+
$dependencies_projection + '-cleaned', {
5+
})
6+
YIELD nodeId, localClusteringCoefficient
7+
WITH gds.util.asNode(nodeId) AS member
8+
,localClusteringCoefficient
9+
WITH coalesce(member.fqn, member.fileName, member.name) AS memberName
10+
,localClusteringCoefficient
11+
WITH round(localClusteringCoefficient, 2) AS localClusteringCoefficient
12+
,collect(DISTINCT memberName)[0..9] AS memberNameExamples
13+
,count(DISTINCT memberName) AS memberCount
14+
RETURN localClusteringCoefficient
15+
,memberCount
16+
,memberNameExamples
17+
ORDER BY localClusteringCoefficient DESC, memberCount DESC
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Community Detection - Local Clustering Coefficient - Write
2+
3+
CALL gds.localClusteringCoefficient.write(
4+
$dependencies_projection + '-cleaned', {
5+
writeProperty: $dependencies_projection_write_property
6+
})
7+
YIELD averageClusteringCoefficient, nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, writeMillis
8+
RETURN averageClusteringCoefficient, nodeCount, nodePropertiesWritten, preProcessingMillis, computeMillis, postProcessingMillis, writeMillis

cypher/Dependencies_Projection/Dependencies_10_Delete_Label.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Community Detection Label Propagation Label Delete
22

33
CALL db.labels() YIELD label
4-
WHERE label STARTS WITH $dependencies_projection_node + $dependencies_projection_write_label
4+
WHERE label STARTS WITH 'Mark4' + $dependencies_projection_node + $dependencies_projection_write_label
55
WITH collect(label) AS selectedLabels
66
MATCH (member)
77
WHERE $dependencies_projection_node IN labels(member)

0 commit comments

Comments
 (0)