示例#1
0
 public void FloydVsBellmannGraphML()
 {
     foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests())
     {
         CompareAlgorithms(graph, _ => 1.0, (g, d) => new BellmanFordShortestPathAlgorithm <string, Edge <string> >(g, d));
     }
 }
 public void FloydVsDijkstraGraphML()
 {
     foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests())
     {
         CompareAlgorithms(graph, e => 1, (g, d) => new DijkstraShortestPathAlgorithm <string, Edge <string> >(g, d));
     }
 }
示例#3
0
 public void DagShortestPath()
 {
     foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests(50))
     {
         DagShortestPath_Test(graph);
         DagCriticalPath_Test(graph);
     }
 }
示例#4
0
 public void EdgeDepthFirstSearch()
 {
     foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests())
     {
         RunEdgeDFSAndCheck(graph);
         RunEdgeDFSAndCheck(graph, 12);
     }
 }
 public void Dijkstra()
 {
     foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests())
     {
         foreach (string root in graph.Vertices)
         {
             RunDijkstraAndCheck(graph, root);
         }
     }
 }
 public void CyclePoppingRandomTree()
 {
     foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests(10))
     {
         foreach (string root in graph.Vertices)
         {
             RunCyclePoppingRandomTreeAndCheck(graph, root);
         }
     }
 }
 public void BreadthFirstSearch()
 {
     foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests())
     {
         foreach (string vertex in graph.Vertices)
         {
             RunBFSAndCheck(graph, vertex);
         }
     }
 }
示例#8
0
 public void EdmondsKarpMaxFlow()
 {
     foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests(100))
     {
         if (graph.VertexCount > 1)
         {
             EdmondsKarpMaxFlow(graph, (source, target) => new Edge <string>(source, target));
         }
     }
 }
 public void ImplicitDepthFirstSearch()
 {
     foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests(10))
     {
         foreach (string vertex in graph.Vertices)
         {
             RunImplicitDFSAndCheck(graph, vertex);
             RunImplicitDFSAndCheck(graph, vertex, 12);
         }
     }
 }
示例#10
0
        public void TarjanOfflineLeastCommonAncestor()
        {
            foreach (AdjacencyGraph <string, Edge <string> > graph in TestGraphFactory.GetAdjacencyGraphs_SlowTests())
            {
                if (graph.VertexCount == 0)
                {
                    continue;
                }

                var pairs = new List <SEquatableEdge <string> >();
                foreach (string u in graph.Vertices)
                {
                    foreach (string v in graph.Vertices)
                    {
                        if (!u.Equals(v))
                        {
                            pairs.Add(new SEquatableEdge <string>(u, v));
                        }
                    }
                }

                int count = 0;
                foreach (string root in graph.Vertices)
                {
                    RunTarjanOfflineLeastCommonAncestorAndCheck(
                        graph,
                        root,
                        pairs.ToArray());

                    if (count++ > 10)
                    {
                        break;
                    }
                }
            }
        }