Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base k disjoint shortest paths improvement #658

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

assimiz
Copy link

@assimiz assimiz commented Aug 14, 2018

Fixing issue #648. Now inducing the working graph using the connected component of the source.

@jsichi jsichi changed the title Base k disjoint shortets paths improvement Base k disjoint shortest paths improvement Aug 26, 2018
// connected component of the start vertex, we are inducing the working graph from
// the connected component.
Graph<V, E> connectedComponentGraph = new AsSubgraph<>(this.originalGraph,
new ConnectivityInspector<>(this.originalGraph).connectedSetOf(startVertex));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling ConnectivityInspector is correct and simple, but it duplicates the work performed by the first invocation of calculateShortestPath (which can run against the original). Can you think of a way to avoid that without too much extra complexity?

Also, the common case where the graph is connected is easy to detect (connected component size == full graph size); so in that case, we should avoid the AsSubgraph overhead.

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

Successfully merging this pull request may close these issues.

None yet

2 participants