コード例 #1
0
        public void SourceFirstBidirectionalTopologicalSort_DCT8()
        {
            BidirectionalGraph <string, Edge <string> > graph = TestGraphFactory.LoadBidirectionalGraph(GetGraphFilePath("DCT8.graphml"));

            RunSourceFirstTopologicalSortAndCheck(graph, TopologicalSortDirection.Forward);
            RunSourceFirstTopologicalSortAndCheck(graph, TopologicalSortDirection.Backward);
        }
        public void SortDCT()
        {
            var g = TestGraphFactory.LoadBidirectionalGraph("GraphML/DCT8.graphml");

            var topo = new SourceFirstTopologicalSortAlgorithm <string, Edge <string> >(g);

            topo.Compute();
        }
        public void Sort_DCT8()
        {
            BidirectionalGraph <string, Edge <string> > graph = TestGraphFactory.LoadBidirectionalGraph(GetGraphFilePath("DCT8.graphml"));

            var algorithm = new SourceFirstTopologicalSortAlgorithm <string, Edge <string> >(graph);

            algorithm.Compute();
        }
コード例 #4
0
        public void SortDCT()
        {
            var g = TestGraphFactory.LoadBidirectionalGraph("DCT8.graphml");

            SourceFirstBidirectionalTopologicalSortAlgorithm <string, Edge <string> > topo;

            topo = new SourceFirstBidirectionalTopologicalSortAlgorithm <string, Edge <string> >(g, TopologicalSortDirection.Forward);
            topo.Compute();

            topo = new SourceFirstBidirectionalTopologicalSortAlgorithm <string, Edge <string> >(g, TopologicalSortDirection.Backward);
            topo.Compute();
        }
コード例 #5
0
        private object LoadSingleGraph(string path)
        {
            switch (this.Type)
            {
            case GraphType.AdjacencyGraph: return(TestGraphFactory.LoadGraph(path));

            case GraphType.BidirectionalGraph: return(TestGraphFactory.LoadBidirectionalGraph(path));

            case GraphType.UndirectedGraph: return(TestGraphFactory.LoadUndirectedGraph(path));

            default: throw new NotSupportedException();
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: barsgroup/QuickGraph
        static void Main(string[] args)
        {
            // new TarjanOfflineLeastCommonAncestorAlgorithmTest().TarjanOfflineLeastCommonAncestorAlgorithmAll();
            // new DijkstraShortestPathAlgorithmTest().DijkstraAll();
            // new MinimumSpanningTreeTest().PrimKruskalMinimumSpanningTreeAll();
            var g         = TestGraphFactory.LoadBidirectionalGraph(@"graphml\repro12359.graphml");
            var distances = new Dictionary <Edge <string>, double>(g.EdgeCount);

            foreach (var e in g.Edges)
            {
                distances[e] = g.OutDegree(e.Source) + 1;
            }
            var root = Enumerable.First(g.Vertices);

            foreach (var v in g.Vertices)
            {
                FrontierDijkstra(g, distances, root, v);
            }
        }