Neo4j Gremlin: all shortest weigthed path -
we using neo4j 2.0 embedded; have graph around 1 million of nodes, , 50 million of relationships; have find n shortestpath known cost property saw there no such method in graphalgo class of neo4j , thinking use gremlin (or other utility) in order find these paths. our wish specify relationship property consider shortest paths finding
did find solution problem? how implement such functionality?
any suggestion apreciated... thank angelo
you can use gremlin calculate shortest paths. here's example in gremlindocs:
http://gremlindocs.com/#recipes/shortest-path
the following snippet section discusses use of "weight" property calculate cost of path:
gremlin> g = tinkergraphfactory.createtinkergraph() ==>tinkergraph[vertices:6 edges:6] gremlin> g.v(1).oute.inv.loop(2){it.object.id!="3" && it.loops < 6}.path.filter{it.last().id=="3"}.transform{[it.findall{it instanceof edge}.sum{it.weight}, it]} ==>[0.4, [v[1], e[9][1-created->3], v[3]]] ==>[1.4000000059604645, [v[1], e[8][1-knows->4], v[4], e[11][4-created->3], v[3]]]
i'm not sure if you're after, perhaps inspire solution.
Comments
Post a Comment