Skip to content
This repository has been archived by the owner on Oct 21, 2021. It is now read-only.

Definition of a distance matrix in distance_matrix() is misleading #232

Open
BoundaryValueProblems opened this issue Dec 20, 2016 · 1 comment

Comments

@BoundaryValueProblems
Copy link

I just started using Graphs.jl, but the definition of a distance matrix of a given graph g that is returned from the function distance_matrix(g, eweights) is quite unconventional and misleading. In the documentation of Graphs.jl, the distance matrix is defined as follows:
If u = v, then W[u,v]=0.
If u !=v and (u,v) belongs to the edge set of g, then W[u,v] = edge weight of (u,v).
Otherwise W[u,v] = Inf.

But normally, the definition of the distance matrix of g is:
If there is paths between u and v, then W[u, v] = the minimum among the sums of the edge weights of all the paths connecting between u and v (i.e., the length of the shortest path between u and v);
If there is no path between u and v, then W[u,v] = Inf.

Has someone implemented this correct version of the distance matrix using Graphs.jl functions?
Thanks!
BVPs

@dehann
Copy link
Contributor

dehann commented Dec 21, 2016

Hi @BoundaryValueProblems, thanks for noting this. Adding subgraph methods might be related to this, which I'm interested in doing. Such as asking for the subgraph between 2+ nodes. This would then return all nodes and edges that connect the nodes, or just the short connectivity path, or maybe the lowest cost path (although not my direct use case). I'd think this requires similar code. Guess we'd have to explore all paths and pick the minimum cost, and then return that result.

Feel free to create a fork and branch from this repo with a suggestion of how you think we could fix this. I can help along the way. Or I can try do it while working on subgraphs aspect in future...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants