Skip to content

Base k disjoint shortest paths improvement - #658

Open
assimiz wants to merge 6 commits into
jgrapht:masterfrom
assimiz:BaseKDisjointShortetsPaths_Improvement
Open

assimiz wants to merge 6 commits into
jgrapht:masterfrom
assimiz:BaseKDisjointShortetsPaths_Improvement

Conversation

@assimiz

@assimiz assimiz commented Aug 14, 2018

Copy link
Copy Markdown

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
Copy Markdown
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.

This branch has not been deployed

No deployments
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.

2 participants