Closed merjana closed 7 years ago
What do you mean?
for example if we need to find the shortest path between two nodes implementing Dijkstra's algorithm, we should know the distance of each edge, is there any function to add for example graph.addEdge("a", "b",2); which 2 is the distance between a and b
Oh I see what you mean; the weight of an edge (not the weight of a node).
That functionality is not present at the moment, but I don't think it would be very difficult to add.
In terms of implementation, I think it would make sense to add an object called weights
that has keys as some encoding of edges (e.g. "a|b"
for an edge that goes from A to B) and values as the weights.
Are you working on adding Dijkstra's algorithm? If you have any work in progress to show, I'd be happy to take a look.
Released in 1.0, you should be able to use it now.
thank you @curran ,i appreciate that
how to add the weight of the node ?