LOG.debug(graph.addBuilderAnnotation(new GraphConnectivity(island.getRepresentativeVertex(), island.streetSize())));
}
private static Subgraph computeConnectedSubgraph(
Map<Vertex, ArrayList<Vertex>> neighborsForVertex, Vertex startVertex) {
Subgraph subgraph = new Subgraph();
Queue<Vertex> q = new LinkedList<Vertex>();
q.add(startVertex);
while (!q.isEmpty()) {
Vertex vertex = q.poll();
for (Vertex neighbor : neighborsForVertex.get(vertex)) {
if (!subgraph.contains(neighbor)) {
subgraph.addVertex(neighbor);
q.add(neighbor);
}
}
}
return subgraph;