Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions domains/anomaly-detection/graphs/TopAuthority.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
MATCH (sourceForStatistics)-[dependencyForStatistics:DEPENDS_ON]->(targetForStatistics)
WHERE $projection_node_label IN labels(sourceForStatistics)
AND $projection_node_label IN labels(targetForStatistics)
WITH max(coalesce(dependencyForStatistics.weight25PercentInterfaces, dependencyForStatistics.weight)) AS maxWeight
WITH max(coalesce(dependencyForStatistics[$projection_weight_property])) AS maxWeight
,percentileDisc(sourceForStatistics.centralityPageRankToArticleRankDifference, 0.80) AS pageToArticleRankThreshold
,percentileDisc(targetForStatistics.centralityPageRankNormalized, 0.80) AS pageRankThreshold
// Step 2: Query selected central node
Expand All @@ -26,12 +26,12 @@
WITH *, "🏛️ authority #" + central.anomalyAuthorityRank + "\\n" + central.name AS centralNodeLabel
WITH *, graphVizOutput + ["central [label=\"" + centralNodeLabel + "\"];"] AS graphVizOutput
// Step 3: Query direct incoming dependencies to the central node
MATCH (source)-[dependency:DEPENDS_ON]->(central)
OPTIONAL MATCH (source)-[dependency:DEPENDS_ON]->(central)
WHERE $projection_node_label IN labels(source)
AND source.outgoingDependencies > 0
ORDER BY dependency.weight DESC, source.name ASC
ORDER BY dependency[$projection_weight_property] DESC, source.name ASC
LIMIT 40
WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight
WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight
WITH *, round((toFloat(weight) / toFloat(maxWeight) * 2.5) + 0.4, 1.0) AS penWidth
WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=" + penWidth AS edgeAttributes
WITH *, CASE WHEN source.centralityPageRankToArticleRankDifference >= pageToArticleRankThreshold
Expand All @@ -56,12 +56,12 @@
,collect(directInNode + "\"" + sourceId + "\" -> central [" + edgeAttributes + "];") AS directInEdges
WITH *, graphVizOutput + directInEdges AS graphVizOutput
// Step 4: Query direct outgoing dependencies from the central node
MATCH (source)<-[dependency:DEPENDS_ON]-(central)
OPTIONAL MATCH (source)<-[dependency:DEPENDS_ON]-(central)
WHERE $projection_node_label IN labels(source)
AND source.incomingDependencies > 0
ORDER BY dependency.weight DESC, source.name ASC
ORDER BY dependency[$projection_weight_property] DESC, source.name ASC
LIMIT 40
WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight
WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight
WITH *, round((toFloat(weight) / toFloat(maxWeight) * 2.5) + 0.4, 1.0) AS penWidth
WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=" + penWidth AS edgeAttributes
// Use a lighter color for the target nodes of outgoing dependencies from the central node and their edges
Expand Down Expand Up @@ -90,16 +90,16 @@
WITH *, incomingDependencyNodes + outgoingDependencyNodes AS directDependentNodes
// Step 5: Query dependencies between direct dependencies outside the central node
UNWIND directDependentNodes AS directDependentNode
MATCH (directDependentNode)-[dependency:DEPENDS_ON]->(anotherDirectDependentNode)
OPTIONAL MATCH (directDependentNode)-[dependency:DEPENDS_ON]->(anotherDirectDependentNode)
WHERE anotherDirectDependentNode IN directDependentNodes
AND anotherDirectDependentNode <> directDependentNode
ORDER BY dependency.weight DESC, directDependentNode.name ASC
ORDER BY dependency[$projection_weight_property] DESC, directDependentNode.name ASC
WITH graphVizOutput
,directDependentNode
,dependency
,collect(anotherDirectDependentNode)[0] AS firstLinkedDependentNode
LIMIT 140
WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight
WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight
// Use a fixed small pen width for secondary dependencies for better visibility of the more important direct dependency
WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=0.3" AS edgeAttributes
// Use an even lighter color for secondary dependency edges
Expand Down
26 changes: 12 additions & 14 deletions domains/anomaly-detection/graphs/TopBottleneck.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
MATCH (sourceForStatistics)-[dependencyForStatistics:DEPENDS_ON]->(targetForStatistics)
WHERE $projection_node_label IN labels(sourceForStatistics)
AND $projection_node_label IN labels(targetForStatistics)
WITH max(coalesce(dependencyForStatistics.weight25PercentInterfaces, dependencyForStatistics.weight)) AS maxWeight
,percentileDisc(sourceForStatistics.centralityBetweenness, 0.90) AS betweennessThreshold
WITH max(coalesce(dependencyForStatistics[$projection_weight_property])) AS maxWeight
,percentileDisc(sourceForStatistics.centralityBetweenness, 0.90) AS betweennessThreshold
// Step 2: Query selected central node
MATCH (central)
WHERE $projection_node_label IN labels(central)
Expand All @@ -23,12 +23,12 @@
WITH *, "🔒 bottleneck #" + central.anomalyBottleneckRank + "\\n" + central.name AS centralNodeLabel
WITH *, graphVizOutput + ["central [label=\"" + centralNodeLabel + "\"];"] AS graphVizOutput
// Step 3: Query direct incoming dependencies to the central node
MATCH (source)-[dependency:DEPENDS_ON]->(central)
OPTIONAL MATCH (source)-[dependency:DEPENDS_ON]->(central)
WHERE $projection_node_label IN labels(source)
AND source.outgoingDependencies > 0
ORDER BY dependency.weight DESC, source.name ASC
ORDER BY dependency[$projection_weight_property] DESC, source.name ASC
LIMIT 40
WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight
WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight
WITH *, round((toFloat(weight) / toFloat(maxWeight) * 2.5) + 0.4, 1.0) AS penWidth
WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=" + penWidth AS edgeAttributes
WITH *, CASE WHEN source.centralityBetweenness >= betweennessThreshold
Expand All @@ -50,12 +50,12 @@
,collect(directInNode + "\"" + sourceId + "\" -> central [" + edgeAttributes + "];") AS directInEdges
WITH *, graphVizOutput + directInEdges AS graphVizOutput
// Step 4: Query direct outgoing dependencies from the central node
MATCH (source)<-[dependency:DEPENDS_ON]-(central)
OPTIONAL MATCH (source)<-[dependency:DEPENDS_ON]-(central)
WHERE $projection_node_label IN labels(source)
AND source.incomingDependencies > 0
ORDER BY dependency.weight DESC, source.name ASC
ORDER BY dependency[$projection_weight_property] DESC, source.name ASC
LIMIT 40
WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight
WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight
WITH *, round((toFloat(weight) / toFloat(maxWeight) * 2.5) + 0.4, 1.0) AS penWidth
WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=" + penWidth AS edgeAttributes
// Use a lighter color for the target nodes of outgoing dependencies from the central node and their edges
Expand All @@ -72,9 +72,7 @@
WITH *, "label = \"" + sourceNameSplit + "\\n(" + labelValue + ")\"; " AS directOutLabel
WITH *, " [" + directOutLabel + directOutBorder + directOutColor + "]; " AS directOutNodeProperties
WITH *, "\"" + sourceId + "\" " + directOutNodeProperties AS directOutNode
WITH maxWeight
,betweennessThreshold
,central
WITH central
,graphVizOutput
,incomingDependencyNodes
,collect(source) AS outgoingDependencyNodes
Expand All @@ -83,16 +81,16 @@
WITH *, incomingDependencyNodes + outgoingDependencyNodes AS directDependentNodes
// Step 5: Query dependencies between direct dependencies outside the central node
UNWIND directDependentNodes AS directDependentNode
MATCH (directDependentNode)-[dependency:DEPENDS_ON]->(anotherDirectDependentNode)
OPTIONAL MATCH (directDependentNode)-[dependency:DEPENDS_ON]->(anotherDirectDependentNode)
WHERE anotherDirectDependentNode IN directDependentNodes
AND anotherDirectDependentNode <> directDependentNode
ORDER BY dependency.weight DESC, directDependentNode.name ASC
ORDER BY dependency[$projection_weight_property] DESC, directDependentNode.name ASC
WITH graphVizOutput
,directDependentNode
,dependency
,collect(anotherDirectDependentNode)[0] AS firstLinkedDependentNode
LIMIT 140
WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight
WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight
// Use a fixed small pen width for secondary dependencies for better visibility of the more important direct dependency
WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=0.3" AS edgeAttributes
// Use an even lighter color for secondary dependency edges
Expand Down
20 changes: 10 additions & 10 deletions domains/anomaly-detection/graphs/TopBridge.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
MATCH (sourceForStatistics)-[dependencyForStatistics:DEPENDS_ON]->(targetForStatistics)
WHERE $projection_node_label IN labels(sourceForStatistics)
AND $projection_node_label IN labels(targetForStatistics)
WITH max(coalesce(dependencyForStatistics.weight25PercentInterfaces, dependencyForStatistics.weight)) AS maxWeight
WITH max(coalesce(dependencyForStatistics[$projection_weight_property])) AS maxWeight
// Step 2: Query selected central node
MATCH (central)
WHERE $projection_node_label IN labels(central)
Expand All @@ -19,12 +19,12 @@
WITH *, "🌉 bridge #" + central.anomalyBridgeRank + "\\n" + central.name AS centralNodeLabel
WITH *, graphVizOutput + ["central [label=\"" + centralNodeLabel + "\"];"] AS graphVizOutput
// Step 3: Query direct incoming dependencies to the central node
MATCH (source)-[dependency:DEPENDS_ON]->(central)
OPTIONAL MATCH (source)-[dependency:DEPENDS_ON]->(central)
WHERE $projection_node_label IN labels(source)
AND source.outgoingDependencies > 0
ORDER BY dependency.weight DESC, source.name ASC
ORDER BY dependency[$projection_weight_property] DESC, source.name ASC
LIMIT 40
WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight
WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight
WITH *, round((toFloat(weight) / toFloat(maxWeight) * 2.5) + 0.4, 1.0) AS penWidth
WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=" + penWidth AS edgeAttributes
// Add the last part of the element id to the node name to make it unique.
Expand All @@ -41,12 +41,12 @@
,collect(directInNode + "\"" + sourceId + "\" -> central [" + edgeAttributes + "];") AS directInEdges
WITH *, graphVizOutput + directInEdges AS graphVizOutput
// Step 4: Query direct outgoing dependencies from the central node
MATCH (source)<-[dependency:DEPENDS_ON]-(central)
OPTIONAL MATCH (source)<-[dependency:DEPENDS_ON]-(central)
WHERE $projection_node_label IN labels(source)
AND source.incomingDependencies > 0
ORDER BY dependency.weight DESC, source.name ASC
ORDER BY dependency[$projection_weight_property] DESC, source.name ASC
LIMIT 40
WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight
WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight
WITH *, round((toFloat(weight) / toFloat(maxWeight) * 2.5) + 0.4, 1.0) AS penWidth
WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=" + penWidth AS edgeAttributes
// Use a lighter color for the target nodes of outgoing dependencies from the central node and their edges
Expand All @@ -70,16 +70,16 @@
WITH *, incomingDependencyNodes + outgoingDependencyNodes AS directDependentNodes
// Step 5: Query dependencies between direct dependencies outside the central node
UNWIND directDependentNodes AS directDependentNode
MATCH (directDependentNode)-[dependency:DEPENDS_ON]->(anotherDirectDependentNode)
OPTIONAL MATCH (directDependentNode)-[dependency:DEPENDS_ON]->(anotherDirectDependentNode)
WHERE anotherDirectDependentNode IN directDependentNodes
AND anotherDirectDependentNode <> directDependentNode
ORDER BY dependency.weight DESC, directDependentNode.name ASC
ORDER BY dependency[$projection_weight_property] DESC, directDependentNode.name ASC
WITH graphVizOutput
,directDependentNode
,dependency
,collect(anotherDirectDependentNode)[0] AS firstLinkedDependentNode
LIMIT 140
WITH *, coalesce(dependency.weight25PercentInterfaces, dependency.weight, 1) AS weight
WITH *, coalesce(dependency[$projection_weight_property], 1) AS weight
// Use a fixed small pen width for secondary dependencies for better visibility of the more important direct dependency
WITH *, "label=" + weight + "; weight=" + weight + "; penwidth=0.3" AS edgeAttributes
// Use an even lighter color for secondary dependency edges
Expand Down
Loading
Loading