Quantcast
Viewing all articles
Browse latest Browse all 25

Commented Unassigned: Finding Disconnected Subgraphs or Components [25751]

In my graphs, I generally have at least two completely disconnected subgraphs or components. These components may be of 1 or N vertices. I can easily detect orphans, but not components.

Orphans are easy:

myGraph.Vertices.Where(v => myGraph.InDegree(v) == 0)

I have no idea how to get the disconnected components. Ideally, I'd like to return an IEnumerable<BidirectionalGraph<T>> from myGraph which is BidirectionalGraph<T>.
Comments: ** Comment from web user: bobby751 **

I would be very interested by this feature, and I did not find how to do it yet.

It seems like the function does part of the job:
Func<KeyValuePair<int, IDictionary<DataVertex, int>>> components = AlgorithmExtensions.IncrementalConnectedComponents(graph);
var current = components();

By examining current, you see vertices that share the same branches (see value index).
But it does not give directly the list of sub-graphs: IEnumerable<BidirectionalGraph<T>>


Maybe the weaklyConnectedComponents, and condensateWeaklyConnected extensions can do the job.
I haven't been able to implement any of them.

The following code casts an error.
var weaklyCondensated= g.CondensateWeaklyConnected<Vertex,Edge,GraphType>();

I would be very interested to have a solution for this.
Thanks a lot


Viewing all articles
Browse latest Browse all 25

Trending Articles