コード例 #1
0
        public void Compute([PexAssumeNotNull] IUndirectedGraph <string, Edge <string> > g)
        {
            UndirectedTopologicalSortAlgorithm <string, Edge <string> > topo =
                new UndirectedTopologicalSortAlgorithm <string, Edge <string> >(g);

            topo.AllowCyclicGraph = true;
            topo.Compute();

            Display(topo);
        }
コード例 #2
0
        private void Compute(IUndirectedGraph <string, Edge <string> > g)
        {
            UndirectedTopologicalSortAlgorithm <string, Edge <string> > topo =
                new UndirectedTopologicalSortAlgorithm <string, Edge <string> >(g);

            topo.AllowCyclicGraph = true;
            topo.Compute();

            Display(topo);
        }
コード例 #3
0
        /// <summary>
        /// Creates a topological sort of a undirected
        /// acyclic graph.
        /// </summary>
        /// <typeparam name="TVertex">type of the vertices</typeparam>
        /// <typeparam name="TEdge">type of the edges</typeparam>
        /// <param name="visitedGraph"></param>
        /// <param name="vertices"></param>
        /// <returns></returns>
        /// <exception cref="NonAcyclicGraphException">the input graph
        /// has a cycle</exception>
        public static void TopologicalSort <TVertex, TEdge>
            (this IUndirectedGraph <TVertex, TEdge> visitedGraph, IList <TVertex> vertices)
            where TEdge : IEdge <TVertex>
        {
            Contract.Requires(visitedGraph != null);
            Contract.Requires(vertices != null);

            var topo = new UndirectedTopologicalSortAlgorithm <TVertex, TEdge>(visitedGraph);

            topo.Compute(vertices);
        }
コード例 #4
0
ファイル: AlgoUtility.cs プロジェクト: eosfor/quickgraph-peli
        public static void TopologicalSort <TVertex, TEdge>(
            IUndirectedGraph <TVertex, TEdge> visitedGraph,
            IList <TVertex> vertices
            )
            where TEdge : IEdge <TVertex>
        {
            GraphContracts.AssumeNotNull(visitedGraph, "visitedGraph");
            GraphContracts.AssumeNotNull(vertices, "vertices");

            var topo = new UndirectedTopologicalSortAlgorithm <TVertex, TEdge>(visitedGraph);

            topo.Compute(vertices);
        }