I'm working with ArangoDB and have a graph traversal scenario where I need to skip a specific node based on a property, but still infer an indirect connection (edge) between two other nodes. My graph contains edges from A to B and B to C, but not directly from A to C. Node B has a property `ShouldSkip` set to true, and I want to skip it in the traversal results.
The desired outcome is to get edges: edge from A to C (inferred), and nodes: A and C, effectively skipping B in the results. However, since there's no direct edge from A to C in the graph, I'm not sure how to represent this in the query results.
Here's my current AQL query:
LET startNodeId = 'A' // Example start node
LET depth = 2
LET startNode = DOCUMENT('nodeCollectionName', startNodeId)
LET traversalResults = (
FOR v, e IN 1..depth OUTBOUND startNode GRAPH 'graphName'
FILTER v.ShouldSkip != true
LIMIT 100
RETURN {node: v, edge: e}
)
LET allNodes = (
FOR tr IN traversalResults
RETURN tr.node
)
LET allEdges = (
FOR tr IN traversalResults
RETURN tr.edge
)
RETURN {StartNode: startNode, Nodes: UNIQUE(FLATTEN(allNodes)), Edges: UNIQUE(FLATTEN(allEdges))}
How can I adjust this query to infer an edge from A to C (only! without A to B and B to C), or is there a better approach to achieve this in ArangoDB (like while in indexing create a virtual edge of A to C - much less preferable)?
Effectively I would like the response to be: nodes: [A,C] edges: [{_from: A, _to: C}]
