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); }
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); }
/// <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); }
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); }