public TopologicalOrder(IGraph graph, Flags flags = Flags.None)
        {
            Graph = graph;
            if ((flags & Flags.CreateOrder) != 0)
            {
                Order = new List <Node>();
            }
            MyDfs myDfs = new MyDfs();

            myDfs.Parent = this;
            myDfs.Run(graph, null);
        }
示例#2
0
        public ConnectedComponents(IGraph graph, Flags flags = Flags.None)
        {
            Graph = graph;
            if ((flags & Flags.CreateComponents) != 0)
            {
                Components = new List <HashSet <Node> >();
            }
            MyDfs myDfs = new MyDfs();

            myDfs.Parent = this;
            myDfs.Run(graph, null);
        }
        public Bipartition(IGraph graph, Flags flags = Flags.None)
        {
            Graph = graph;
            if ((flags & Flags.CreateRedNodes) != 0)
            {
                RedNodes = new HashSet <Node>();
            }
            if ((flags & Flags.CreateBlueNodes) != 0)
            {
                BlueNodes = new HashSet <Node>();
            }
            MyDfs myDfs = new MyDfs();

            myDfs.Parent = this;
            myDfs.Run(graph, null);
        }