113 |
} |
} |
114 |
} |
} |
115 |
|
|
116 |
/** Finds components disconnected along a given non-directed property, |
/** From given nodes, finds components disconnected along a given |
117 |
|
* non-directed property, |
118 |
* and for each component returns the node of highest degree as a |
* and for each component returns the node of highest degree as a |
119 |
* representative. |
* representative. |
120 |
* @return set of representatives, one for each component |
* @return set of representatives, one for each component |
121 |
*/ |
*/ |
122 |
public static Set findComponents(Object property, ConstGraph g) { |
public static Set findComponents(Iterator nodes, Object property, |
123 |
// XXX "Iterator nodes" could be a parameter |
ConstGraph g) { |
|
Iterator nodes = g.findN_XAA_Iter(); // FIXME doesn't find objects |
|
124 |
Set visited = new HashSet(); |
Set visited = new HashSet(); |
125 |
Set components = new HashSet(); |
Set components = new HashSet(); |
126 |
while(nodes.hasNext()) { |
while(nodes.hasNext()) { |