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));
  }
}

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 .
