예제 #1
0
 public static <V, W, E extends DirectedWeightedEdge<V, W>> void relaxEnough(
     Graph<V, E> graph,
     SingleSourceShortestPathCalcStatus<V, W, E> status,
     InfinitableAddableNumberSystem<W> ns) {
   for (int i = 0; i < graph.getVertices().size() - 1; i++)
     for (E e : AllEdgeInGraph.wrap(graph)) Relax.relax(status.distance, status.previous, e, ns);
 }
예제 #2
0
 public static <V, E, W> SingleSourceShortestPathCalcStatus<V, W, E> createInitialStatus(
     Graph<V, E> graph, V from, InfinitableAddableNumberSystem<W> ns) {
   SingleSourceShortestPathCalcStatus<V, W, E> status =
       new SingleSourceShortestPathCalcStatus<V, W, E>();
   for (V v : graph.getVertices()) status.distance.add(v, ns.getInfinity());
   status.distance.replace(from, ns.getZero());
   return status;
 }