private void computeShortestPathsFromSource(V source){
  BFSDistanceLabeler<V,E> labeler=new BFSDistanceLabeler<V,E>();
  labeler.labelDistances(mGraph,source);
  distances=labeler.getDistanceDecorator();
  Map<V,Number> currentSourceSPMap=new HashMap<V,Number>();
  Map<V,E> currentSourceEdgeMap=new HashMap<V,E>();
  for (  V vertex : mGraph.getVertices()) {
    Number distanceVal=distances.get(vertex);
    if (distanceVal != null && distanceVal.intValue() >= 0) {
      currentSourceSPMap.put(vertex,distanceVal);
      int minDistance=distanceVal.intValue();
      for (      E incomingEdge : mGraph.getInEdges(vertex)) {
        for (        V neighbor : mGraph.getIncidentVertices(incomingEdge)) {
          if (neighbor.equals(vertex))           continue;
          Number predDistanceVal=distances.get(neighbor);
          int pred_distance=predDistanceVal.intValue();
          if (pred_distance < minDistance && pred_distance >= 0) {
            minDistance=predDistanceVal.intValue();
            currentSourceEdgeMap.put(vertex,incomingEdge);
          }
        }
      }
    }
  }
  mDistanceMap.put(source,currentSourceSPMap);
  mIncomingEdgeMap.put(source,currentSourceEdgeMap);
}

private void computeShortestPathsFromSource ( V source ) { BFSDistanceLabeler < V , E > labeler = new BFSDistanceLabeler < V , E > ( ) ; labeler . labelDistances ( mGraph , source ) ; distances = labeler . getDistanceDecorator ( ) ; Map < V , Number > currentSourceSPMap = new HashMap < V , Number > ( ) ; Map < V , E > currentSourceEdgeMap = new HashMap < V , E > ( ) ; for ( V vertex : mGraph . getVertices ( ) ) { Number distanceVal = distances . get ( vertex ) ; if ( distanceVal != null && distanceVal . intValue ( ) >= 0 ) { currentSourceSPMap . put ( vertex , distanceVal ) ; int minDistance = distanceVal . intValue ( ) ; for ( E incomingEdge : mGraph . getInEdges ( vertex ) ) { for ( V neighbor : mGraph . getIncidentVertices ( incomingEdge ) ) { if ( neighbor . equals ( vertex ) ) continue ; Number predDistanceVal = distances . get ( neighbor ) ; int pred_distance = predDistanceVal . intValue ( ) ; if ( pred_distance < minDistance && pred_distance >= 0 ) { minDistance = predDistanceVal . intValue ( ) ; currentSourceEdgeMap . put ( vertex , incomingEdge ) ; } } } } } mDistanceMap . put ( source , currentSourceSPMap ) ; mIncomingEdgeMap . put ( source , currentSourceEdgeMap ) ; }
computes the shortest path distances from a given node to all other nodes .
