Skip to content
Snippets Groups Projects
Commit d0179563 authored by Sven-Ove Hänsel's avatar Sven-Ove Hänsel
Browse files

update gitignore

parent 8a6ecacd
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,12 @@ code/infrastructure/sql/*
code/infrastructure/neo4j/*
code/infrastructure/ongdb/*
code/infrastructure/memgraph/*
code/infrastructure/eval/query/memgraph/log
code/infrastructure/eval/query/neo4j/log
code/infrastructure/eval/query/ongdb/log
code/infrastructure/eval/query/pg/log
code/eval/spielwiese
code/infrastructure/eval/*
code/tests/bulk
spielwiese
code/infrastructure/monitoring/dashboards
......
anc|MATCH path=(node:Host)-[*]->(ancestor) RETURN ancestor, size(path) AS distance_upstream ORDER BY distance_upstream;
desc|MATCH path=(node:Host)<-[*]-(descendant) RETURN descendant, size(path) AS distance_downstream ORDER BY distance_downstream;
path|MATCH path = (a:Subject {_uuid:'0CF2BB3E-36B8-11E8-BF66-D9AA8AFF4A69'})-[ *bfs]-(b:Event) RETURN path;
2-hop|MATCH (a:Subject) where a._uuid='0CF2BB3E-36B8-11E8-BF66-D9AA8AFF4A69' CALL neighbors.by_hop(a, [""], 2) YIELD nodes RETURN nodes;
\ No newline at end of file
anc|MATCH path=(node:Host)-[*]->(ancestor) RETURN ancestor, length(path) AS distance_upstream ORDER BY distance_upstream;
desc|MATCH path=(node:Host)<-[*]-(descendant) RETURN descendant, length(path) AS distance_downstream ORDER BY distance_downstream;
path|MATCH path = shortestPath((a:Subject where a._uuid='0CF2BB3E-36B8-11E8-BF66-D9AA8AFF4A69')-[*]-(b:Event)) RETURN path;
2-hop|MATCH (startNode: Host)-[*1..2]-(neighborhood) RETURN neighborhood;
\ No newline at end of file
anc|MATCH path=(node:Host)-[*]->(ancestor) RETURN ancestor, length(path) AS distance_upstream ORDER BY distance_upstream;
desc|MATCH path=(node:Host)<-[*]-(descendant) RETURN descendant, length(path) AS distance_downstream ORDER BY distance_downstream;
path|MATCH (a:Subject)-[*]-(b:Event) WHERE a._uuid = '0CF2BB3E-36B8-11E8-BF66-D9AA8AFF4A69' WITH a, b MATCH path = shortestPath((a)-[*]-(b)) RETURN path
2-hop|MATCH (startNode: Host)-[*1..2]-(neighborhood) RETURN neighborhood;
\ No newline at end of file
ancestors|WITH RECURSIVE AncestorCTE AS (
SELECT n.node_no, e.dest, n.type, 1 AS Level
FROM node_list n
JOIN edge_list e ON n.uuid = e.source
WHERE n.node_no = 30 -- Replace with the desired starting node_no
UNION ALL
SELECT n.node_no, e.dest, n.type, d.Level + 1
FROM node_list n
JOIN edge_list e ON n.uuid = e.source
JOIN AncestorCTE d ON e.dest = n.uuid
WHERE d.Level <5 -- Replace with the desired level
)
SELECT DISTINCT node_no, dest, type, Level FROM AncestorCTE;
---
descendant|WITH RECURSIVE DescendantCTE AS (
SELECT n.node_no, e.source, 1 AS Level
FROM node_list n
JOIN edge_list e ON n.uuid = e.dest
WHERE n.node_no = 1 -- Replace with the desired starting node_no
UNION ALL
SELECT n.node_no, e.source, a.Level + 1
FROM node_list n
JOIN edge_list e ON n.uuid = e.dest
JOIN DescendantCTE a ON e.source = n.uuid
WHERE a.Level < 3 -- Replace with the desired level
)
SELECT DISTINCT node_no, source, Level FROM DescendantCTE;
---
path|WITH RECURSIVE path_cte AS (
-- Anchor member initialization
SELECT
el.source AS start_node,
el.dest AS end_node,
ARRAY[el.source::varchar] AS path, -- Cast to varchar to ensure type consistency
1 AS depth -- Keep track of the depth to prevent infinite loops
FROM
edge_list el
WHERE
el.source = '5CC868CD-FF30-5E2B-BB74-6C5B474A62B2' -- Replace with the UUID of the starting node
UNION ALL
-- Recursive member definition
SELECT
p.start_node,
el.dest,
p.path || el.dest::varchar, -- Ensure el.dest is cast to varchar
p.depth + 1
FROM
edge_list el
JOIN
path_cte p ON el.source = p.end_node
WHERE
NOT (el.dest = ANY(p.path)) -- Prevent cycles by ensuring we don't revisit nodes
AND p.depth < 100 -- Example limit to prevent infinite recursion
)
-- Final query to select the path
SELECT distinct
start_node, end_node, path, depth
FROM
path_cte
WHERE
end_node = '83C8ED1F-5045-DBCD-B39F-918F0DF4F851' -- Replace with the UUID of the ending node
ORDER BY
depth ASC -- Optional: orders by the shortest path
--LIMIT 1 -- Optionally limit to one path if multiple paths exist
;
---
k-hop|Select 1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment