initialize(graph, rootSet);
/** * Computes the distances of all the node from the starting root nodes. If there is more than one root node * the minimum distance from each root node is used as the designated distance to a given node. Also keeps track * of the predecessors of each node traversed as well as the order of nodes traversed. * @param graph the graph to label * @param rootSet the set of starting vertices to traverse from */ public void labelDistances(Hypergraph<V,E> graph, Set<V> rootSet) { initialize(graph,rootSet); int distance = 1; while (true) { List<V> newList = new ArrayList<V>(); for(V currentVertex : mCurrentList) { if(graph.containsVertex(currentVertex)) { for(V next : graph.getSuccessors(currentVertex)) { visitNewVertex(currentVertex,next, distance, newList); } } } if (newList.size() == 0) break; mCurrentList = newList; distance++; } for(V v : mUnvisitedVertices) { distanceDecorator.put(v,new Integer(-1)); } }
/** * Computes the distances of all the node from the starting root nodes. If there is more than one root node * the minimum distance from each root node is used as the designated distance to a given node. Also keeps track * of the predecessors of each node traversed as well as the order of nodes traversed. * @param graph the graph to label * @param rootSet the set of starting vertices to traverse from */ public void labelDistances(Hypergraph<V,E> graph, Set<V> rootSet) { initialize(graph,rootSet); int distance = 1; while (true) { List<V> newList = new ArrayList<V>(); for(V currentVertex : mCurrentList) { if(graph.containsVertex(currentVertex)) { for(V next : graph.getSuccessors(currentVertex)) { visitNewVertex(currentVertex,next, distance, newList); } } } if (newList.size() == 0) break; mCurrentList = newList; distance++; } for(V v : mUnvisitedVertices) { distanceDecorator.put(v,new Integer(-1)); } }
initialize(graph, rootSet);