graph - Identify paths between two nodes in neo4j -


i have 2 paths in graph: a-b-c-d , a-b-e-f. assign identification numbers paths, i.e. a-b-c-d 1 , a-b-e-f 2.

is possible? if yes, how?

you mean persistent path id? isn't directly featured, can in query in cypher.

if want somthing persistent, can use index, create relationship index store relationships of path 1 under key/value of path:1.

edit: after getting more information, here's use case using index:

it define in index. here do:

    node = db.createnode();     node b = db.createnode();     node c = db.createnode();     node d = db.createnode();     node e = db.createnode();     node f = db.createnode();      relationship atob = a.createrelationshipto(b, dynamicrelationshiptype.withname("relationship"));     relationship btoc = b.createrelationshipto(c, dynamicrelationshiptype.withname("relationship"));     relationship ctod = c.createrelationshipto(d, dynamicrelationshiptype.withname("relationship"));      relationship btoe = b.createrelationshipto(e, dynamicrelationshiptype.withname("relationship"));     relationship etof = e.createrelationshipto(f, dynamicrelationshiptype.withname("relationship"));      index<relationship> relationshipindex = db.index().forrelationships("pathindex");     string pathrid = uuid.randomuuid().tostring();     string pathmid = uuid.randomuuid().tostring();      relationshipindex.add(atob, "pathid", pathrid);     relationshipindex.add(btoc, "pathid", pathrid);     relationshipindex.add(ctod, "pathid", pathrid);      relationshipindex.add(atob, "pathid", pathmid);     relationshipindex.add(btoe, "pathid", pathmid);     relationshipindex.add(etof, "pathid", pathmid); 

then when want find path, search id. responsible maintaining set id in index, here use uuid, can use more representative of information. relationships not in repeatable order when returned index.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -