🎉 JointJS has new documentation! ðŸ¥³

JointJS+ shortestPath

graphUtils.shortestPath


shortestPath(graph, source, target [, opt])
Return an array of IDs of nodes on the shortest path between source and target. source and target can either be elements or IDs of elements. opt.weight is an optional function returning a distance between two nodes. It defaults to function(u, v) { return 1 }. If opt.directed is true, the algorithm will take link direction into account. The implementation uses the joint.alg.Dijkstra plugin internally. Please refer to the plugin documentation for more information.