Exemplo n.º 1
0
 public static void ShowPathsByAcyclic(this EdgeWeightedDigraph ewg)
 {
     for (int i = 0; i < ewg.V; i++)
     {
         AcyclicSP dapsp = new AcyclicSP(ewg, i);
         for (int j = 0; j < ewg.V; j++)
         {
             if (dapsp.hasPathTo(j) && i != j)
             {
                 Console.WriteLine("{0}-{1} : ", i, j);
                 foreach (var v in dapsp.pathTo(j))
                 {
                     Console.WriteLine(v);
                 }
                 Console.WriteLine("------------------");
             }
         }
     }
 }
Exemplo n.º 2
0
 public static void ShowPathsByAcyclic(this EdgeWeightedDigraph ewg)
 {
     for (int i = 0; i < ewg.V; i++)
     {
         AcyclicSP dapsp = new AcyclicSP(ewg, i);
         for (int j = 0; j < ewg.V; j++)
         {
             if (dapsp.hasPathTo(j) && i!=j)
             {
                 Console.WriteLine("{0}-{1} : ", i, j);
                 foreach (var v in dapsp.pathTo(j))
                 {
                     Console.WriteLine(v);
                 }
                 Console.WriteLine("------------------");
             }
         }
     }
 }