|
4 | 4 | MATCH (sourceForStatistics)-[dependencyForStatistics:DEPENDS_ON]->(targetForStatistics) |
5 | 5 | WHERE $projection_node_label IN labels(sourceForStatistics) |
6 | 6 | AND $projection_node_label IN labels(targetForStatistics) |
7 | | - WITH max(coalesce(dependencyForStatistics.weight25PercentInterfaces, dependencyForStatistics.weight)) AS maxWeight |
8 | | - ,percentileDisc(sourceForStatistics.centralityBetweenness, 0.90) AS betweennessThreshold |
| 7 | + WITH max(coalesce(dependencyForStatistics[$projection_weight_property])) AS maxWeight |
| 8 | + ,percentileDisc(sourceForStatistics.centralityBetweenness, 0.90) AS betweennessThreshold |
9 | 9 | // Step 2: Query selected central node |
10 | 10 | MATCH (central) |
11 | 11 | WHERE $projection_node_label IN labels(central) |
|
23 | 23 | WITH *, "🔒 bottleneck #" + central.anomalyBottleneckRank + "\\n" + central.name AS centralNodeLabel |
24 | 24 | WITH *, graphVizOutput + ["central [label=\"" + centralNodeLabel + "\"];"] AS graphVizOutput |
25 | 25 | // Step 3: Query direct incoming dependencies to the central node |
26 | | - MATCH (source)-[dependency:DEPENDS_ON]->(central) |
| 26 | +OPTIONAL MATCH (source)-[dependency:DEPENDS_ON]->(central) |
27 | 27 | WHERE $projection_node_label IN labels(source) |
28 | 28 | AND source.outgoingDependencies > 0 |
29 | | - ORDER BY dependency.weight DESC, source.name ASC |
| 29 | + ORDER BY dependency[$projection_weight_property] DESC, source.name ASC |
30 | 30 | LIMIT 40 |
31 | | - WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight |
| 31 | + WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight |
32 | 32 | WITH *, round((toFloat(weight) / toFloat(maxWeight) * 2.5) + 0.4, 1.0) AS penWidth |
33 | 33 | WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=" + penWidth AS edgeAttributes |
34 | 34 | WITH *, CASE WHEN source.centralityBetweenness >= betweennessThreshold |
|
50 | 50 | ,collect(directInNode + "\"" + sourceId + "\" -> central [" + edgeAttributes + "];") AS directInEdges |
51 | 51 | WITH *, graphVizOutput + directInEdges AS graphVizOutput |
52 | 52 | // Step 4: Query direct outgoing dependencies from the central node |
53 | | - MATCH (source)<-[dependency:DEPENDS_ON]-(central) |
| 53 | +OPTIONAL MATCH (source)<-[dependency:DEPENDS_ON]-(central) |
54 | 54 | WHERE $projection_node_label IN labels(source) |
55 | 55 | AND source.incomingDependencies > 0 |
56 | | - ORDER BY dependency.weight DESC, source.name ASC |
| 56 | + ORDER BY dependency[$projection_weight_property] DESC, source.name ASC |
57 | 57 | LIMIT 40 |
58 | | - WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight |
| 58 | + WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight |
59 | 59 | WITH *, round((toFloat(weight) / toFloat(maxWeight) * 2.5) + 0.4, 1.0) AS penWidth |
60 | 60 | WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=" + penWidth AS edgeAttributes |
61 | 61 | // Use a lighter color for the target nodes of outgoing dependencies from the central node and their edges |
|
72 | 72 | WITH *, "label = \"" + sourceNameSplit + "\\n(" + labelValue + ")\"; " AS directOutLabel |
73 | 73 | WITH *, " [" + directOutLabel + directOutBorder + directOutColor + "]; " AS directOutNodeProperties |
74 | 74 | WITH *, "\"" + sourceId + "\" " + directOutNodeProperties AS directOutNode |
75 | | - WITH maxWeight |
76 | | - ,betweennessThreshold |
77 | | - ,central |
| 75 | + WITH central |
78 | 76 | ,graphVizOutput |
79 | 77 | ,incomingDependencyNodes |
80 | 78 | ,collect(source) AS outgoingDependencyNodes |
|
83 | 81 | WITH *, incomingDependencyNodes + outgoingDependencyNodes AS directDependentNodes |
84 | 82 | // Step 5: Query dependencies between direct dependencies outside the central node |
85 | 83 | UNWIND directDependentNodes AS directDependentNode |
86 | | - MATCH (directDependentNode)-[dependency:DEPENDS_ON]->(anotherDirectDependentNode) |
| 84 | +OPTIONAL MATCH (directDependentNode)-[dependency:DEPENDS_ON]->(anotherDirectDependentNode) |
87 | 85 | WHERE anotherDirectDependentNode IN directDependentNodes |
88 | 86 | AND anotherDirectDependentNode <> directDependentNode |
89 | | - ORDER BY dependency.weight DESC, directDependentNode.name ASC |
| 87 | + ORDER BY dependency[$projection_weight_property] DESC, directDependentNode.name ASC |
90 | 88 | WITH graphVizOutput |
91 | 89 | ,directDependentNode |
92 | 90 | ,dependency |
93 | 91 | ,collect(anotherDirectDependentNode)[0] AS firstLinkedDependentNode |
94 | 92 | LIMIT 140 |
95 | | - WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight |
| 93 | + WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight |
96 | 94 | // Use a fixed small pen width for secondary dependencies for better visibility of the more important direct dependency |
97 | 95 | WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=0.3" AS edgeAttributes |
98 | 96 | // Use an even lighter color for secondary dependency edges |
|
0 commit comments