Question

Currently, what I'm doing is:

WeakComponentClusterer<Integer, String> wcc = new WeakComponentClusterer<Integer, String>();
Collection<Graph<Integer,String>> ccs = FilterUtils.createAllInducedSubgraphs(wcc.transform(graph),graph);

The problem is that in ccs is stored all the connected components but I just want the giant one (GCC). Since the order of the clusters in the collection css is not determinated by their size, I have to iterate over the whole collection in order to find the giant cluster. The bad thing is that the graph I'm using is huge and has many clusters; so, that iteration costs a lot.

Since I'm new at JUNG I was just wondering if there's a fast way of retrieving the GCC of a graph. Any help is valid.

Was it helpful?

Solution

Probably the easiest way to solve your problem would be to hack WeakComponentClusterer so that it kept track of the component sizes (or of which one was the largest, since that's what you're interested in) as it was constructing them, and then exposed that information to the user.

This is a modification we might make at some point but it's easy enough for you to to in your local copy of the code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top