// adding cutpoints
ListIterator licp = cutpoints.listIterator();
while (licp.hasNext()) {
SimpleVertex element = (SimpleVertex) licp.next();
SimpleVertex toadd = new SimpleVertex();
blk.addVertex(toadd);
toadd.setProperty(CORRESP_KEY, element);
element.setProperty(CORRESP_KEY, toadd);
}
// searching for biconn subgraph count
int esub_count = 0;
ListIterator lie = sg.getEdges()
.listIterator();
while (lie.hasNext()) {
SimpleEdge element = (SimpleEdge) lie.next();
int esub_n = element.getIntProperty(ESUBGRAPH_KEY);
if (esub_n > esub_count) {
esub_count = esub_n;
}
}
// creating vertices
SimpleVertex[] white = new SimpleVertex[esub_count];
for (int i = 0; i < white.length; i++) {
white[i] = new SimpleVertex();
blk.addVertex(white[i]);
}
// setting vertex corresp
lie = sg.getEdges()
.listIterator();
while (lie.hasNext()) {
SimpleEdge element = (SimpleEdge) lie.next();
SimpleVertex svcomp = white[element.getIntProperty(ESUBGRAPH_KEY) - 1];
SimpleVertex v1 = element.getSource();
SimpleVertex v2 = element.getTarget();
//setting corresp vertex not from cutpoints
if ((svcomp.getVertexProperty(CORRESP_KEY) == null)
|| (!cutpoints.contains(v1))) {
svcomp.setProperty(CORRESP_KEY, v1);
}
if ((svcomp.getVertexProperty(CORRESP_KEY) == null)
|| (!cutpoints.contains(v2))) {
svcomp.setProperty(CORRESP_KEY, v2);
}
}
// adding edges
licp = cutpoints.listIterator();
while (licp.hasNext()) {
SimpleVertex element = (SimpleVertex) licp.next();
SimpleVertex svcutp = element.getVertexProperty(CORRESP_KEY);
ListIterator liedges = element.getEdgesRelative(sg)
.listIterator();
List v2c = new ArrayList();
// but no duplicate edges
while (liedges.hasNext()) {
SimpleEdge edge = (SimpleEdge) liedges.next();
SimpleVertex svcomp = white[edge.getIntProperty(ESUBGRAPH_KEY) - 1];
if (!v2c.contains(svcomp)) {
v2c.add(svcomp);
}
}
ListIterator liv2c = v2c.listIterator();
while (liv2c.hasNext()) {
SimpleVertex vertex = (SimpleVertex) liv2c.next();
SimpleEdge toadd = new SimpleEdge(svcutp, vertex);
blk.addEdge(toadd);
}
}