<p>Try <a href="http://gephi.org/features/" rel="nofollow">gephi</a>. I believe that what you plan to do is already implemented there. However, it is open source (3 GPL) and you can get some ideas from the code. The java Graph API description is <a href="http://gephi.org/docs/api/org/gephi/graph/api/package-summary.html" rel="nofollow">here</a>.</p>

<p>Also you might want to review <a href="http://arxiv.org/pdf/0906.0612v2.pdf" rel="nofollow">this</a> article </p>
library to detect overlapping communities in a network?
<p>Looking for a lib that detects overlapping communities in a fairly large network (up to 10,000 nodes) in seconds, not minutes?
[note: by "network" I mean a graph]</p>

<hr>

<p>Responding to a comment asking for details, here is a simple example:</p>

<p>D-E-F<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>
&nbsp;&nbsp;&nbsp;&nbsp;G<br>
&nbsp;&nbsp;&nbsp;&nbsp;  |<br>
A-B-C  </p>

<p>There are many algorithms that are able to detect (D,E,F,G) and (A,B,C) as 2 distinct (non overlapping) communities in this network - or of course, (D,E,F) and (A,B,C,G).</p>

<p>I am looking for an algorithm, implemented in Java, that would be able to detect (D,E,F,G) and (A,B,C,G) as the two overlapping (because they overlap on G) communities in this network.</p>