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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -