public CyclicDetection(NonDiGraph graph)
 {
     this.graph = graph;
     edgeTo = Enumerable.Repeat(-1, graph.V()).ToArray<int>();
     visited = new bool[graph.V ()];
     dfsCyclic ();
 }
Example #2
0
        public CCProcess(NonDiGraph graph)
        {
            this.graph = graph;
            CC = Enumerable.Repeat(-1, graph.V()).ToArray<int>();
            visited = new bool[graph.V ()];

            findConnectedComponents ();
        }
Example #3
0
        public DFSProcess(NonDiGraph graph,int v)
        {
            this.v = v;
            this.graph = graph;
            edgeTo = Enumerable.Repeat(-1, graph.V()).ToArray<int>();

            visited = new bool[graph.V ()];

            depthFirstSearch (v);
        }
        public ColoringProcess(NonDiGraph graph)
        {
            colors = new bool[graph.V()];
            IsTwoColorable = true;
            this.graph = graph;
            edgeTo = Enumerable.Repeat(-1, graph.V()).ToArray<int>();
            visited = new bool[graph.V ()];

            for (int i = 0; i < graph.V(); i++) {
                dfs (i);
            }
        }