ArangoDB: is it possible to 'fake' edges in a graph traversal?

Salavat2

I've got a complex graph. I am using a traversal (through ArangoJS) with also quite complex expanderFunction and traversalVisitor.

For this traversal, I'd like to know if it is possible to create dynamic relations (or fake relations) between some nodes in my graph): That is, based on some attributes in a vertex, let the traversal pursue the graph exploration as if there was an edge between the current vertex and another one.

I've tried to trick the expander function, pushing a fake edge ( from the current vertex to another not related one in the graph) into the traversal data structures, something like:

if (complex_criteria(vertex)) {
    var unconnectedVertexId = ... 
    var unconnectedVertex = someCollection.document(unconnectedVertexId);
    connected.push({ edge:{_id:'newId', _from:vertex._id, _to:unconnectedVertex._id}, vertex: unconnectedVertex });
}
..
return connected;

This did not work. ( traversal options were: direction: 'outbound', strategy: "depthfirst" )

Any better idea ?

Thanks !

mchacki

i think there is a slight mistake in you code:

if (complex_criteria(vertex)) {
    var unconnectedVertexId = ... 
    var unconnectedVertex = someCollection.document(unconnectedVertexId);
    connected.push({ edge:{_id:'newId', _from:vertex._id, _to:unconnectedVertex._id}, vertex: unconnectedVertex });
}
..
return connected;

the "fake-edge" _to has to point to unconnectedVertex._id, not the object itself. Can you check if this fixes the problem already?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Performance issue with Graph Traversal in ArangoDB

From Dev

Arangodb AQL recursive graph traversal

From Dev

Is it possible to create edges and vertexes simultaneously in ArangoDB

From Dev

GRAPH_TRAVERSAL result enclosed in (Array of) Array of Array in Arangodb

From Dev

Programmatically creating edges in ArangoDB

From Dev

ArangoDB: GRAPH_EDGES command very slow (more than 20 sec) on small collections

From Dev

Edges of the graph

From Dev

Edges of the graph

From Dev

Is it possible to configure ArangoDB to make snapshots of the graph database at specific times?

From Dev

Recursive traversal in AQL (ArangoDb)

From Dev

arangodb traverse tree including edges

From Dev

ArangoDB copy Vertex and Edges to neighbors

From Dev

arangodb traverse tree including edges

From Dev

Troubles with arangodb graph viewer

From Dev

ArangoDB Graph Creation API

From Dev

ArangoDB - Graph creation basics

From Dev

Finding probability of edges in a graph

From Dev

Find the outer edges of a graph

From Dev

arrange a graph with random edges

From Dev

Lemon Graph iterate edges

From Dev

Implementing Weighted edges to graph

From Dev

detecting mutual edges in a graph

From Dev

ArangoDB: traverse only edges within a time range

From Dev

ArangoDB: traverse only edges within a time range

From Java

Is it possible to visualize the output of a graph query (Gremlin or SPARQL) as nodes and edges in Amazon Neptune?

From Dev

Adding the lightest possible edges without affecting the graph's minimum spanning tree?

From Dev

Is it possible to fake a higher resolution?

From Dev

Is it possible to fake Internet traffic?

From Dev

Graph traversal using awk

Related Related

HotTag

Archive