I have used an Integer Linear Program (ILP) to generate a path from source
to sink
in a graph. Each variable Pij
in the solution represents a transition from node i
to j
in the path. Unfortunately, the result is a collection of 2 or more disconnected directed subtours, that do not have a transition from one to the other, thereby making the path useless.
There are ways to prevent subtours from happening, but they first require the detection of such disconnected subtours in primitive solution. Now here's my question: how do I detect disconnected subtours?
Some features of the problem:
- I have the primitive solution in the form of both, an adjacency matrix and adjacency list
- The
source
andsink
vertices are distinct. No looping back tosource
- Any vertex in the graph may be traversed any number of times. No rule that it should be traversed only once
My thoughts:
- If there are disconnected subtours, then they are actually acting as independent, directed graphs on their own, and hence the problem can be restated as detecting all graphs within an adjacency matrix/list
- My first instict was to detect all Strongly Connected Components (SCC's) in the graph, but I retracted after realising that Kosaraju's and other such algorithms are infeasible over disconnected subtours. I can apply such algorithms within each subtour, though.
What could solve the problem (According to me):
- Modification of existing SCC detection algorithms to operate on disconnected graphs
- Adaptation of graph traversal algorithms to operate on disconnected graphs
- Any existing method (of course)
- Experience of anyone to have faced a similar issue.