Beispiel #1
0
        private IEnumerable<int> order; // topological order

        #endregion Fields

        #region Constructors

        public Topological(DiGraph G)
        {
            DirectedCycle cyclefinder = new DirectedCycle(G);
            if (!cyclefinder.hasCycle())
            {
                DepthFirstOrder dfs = new DepthFirstOrder(G);
                order = dfs.ReversePost();
            }
        }
Beispiel #2
0
        private IEnumerable <int> order; // topological order

        public Topological(DiGraph G)
        {
            DirectedCycle cyclefinder = new DirectedCycle(G);

            if (!cyclefinder.hasCycle())
            {
                DepthFirstOrder dfs = new DepthFirstOrder(G);
                order = dfs.ReversePost();
            }
        }
Beispiel #3
0
 public static void ShowCycle(this DiGraph dg)
 {
     DirectedCycle Cycle = new DirectedCycle(dg);
     if (Cycle.hasCycle())
     {
         Console.Write("Directed Graph Cycled in : ");
         foreach (var e in Cycle.Cycle())
         {
             Console.Write("{0} ", e);
         }
         Console.WriteLine();
     }
 }
Beispiel #4
0
        public static void ShowCycle(this DiGraph dg)
        {
            DirectedCycle Cycle = new DirectedCycle(dg);

            if (Cycle.hasCycle())
            {
                Console.Write("Directed Graph Cycled in : ");
                foreach (var e in Cycle.Cycle())
                {
                    Console.Write("{0} ", e);
                }
                Console.WriteLine();
            }
        }