GetVertexDegree() public method

public GetVertexDegree ( int vertex ) : int
vertex int
return int
        void DFS(int vertex, bool[] mark, DirectedGraph Graph)
        {
            mark[vertex] = true;

            for (int i = 0; i < Graph.GetVertexDegree(vertex); ++i)
                if (!mark[Graph.GetEdge(vertex, i).End])
                    DFS(Graph.GetEdge(vertex, i).End, mark, Graph);

            _topologicalSort.Add(vertex);
        }
        void AddStrongConnectedComponent(int vertex, int[] mark, DirectedGraph Graph)
        {
            mark[vertex] = StrongConnectedComponentCount;
            _strongConnectedComponentVertices[StrongConnectedComponentCount].Add(vertex);

            for (int i = 0; i < Graph.GetVertexDegree(vertex); ++i)
                if (mark[Graph.GetEdge(vertex, i).End] == StrongConnectedComponentCount || mark[Graph.GetEdge(vertex, i).End] == -1)
                {
                    _strongConnectedComponentEdges[StrongConnectedComponentCount].Add(Graph.GetEdge(vertex, i).Reverse());
                    if (mark[Graph.GetEdge(vertex, i).End] == -1)
                        AddStrongConnectedComponent(Graph.GetEdge(vertex, i).End, mark, Graph);
                }
        }
Beispiel #3
0
        void DFS(int vertex, bool[] mark, DirectedGraph Graph)
        {
            mark[vertex] = true;

            for (int i = 0; i < Graph.GetVertexDegree(vertex); ++i)
            {
                if (!mark[Graph.GetEdge(vertex, i).End])
                {
                    DFS(Graph.GetEdge(vertex, i).End, mark, Graph);
                }
            }

            _topologicalSort.Add(vertex);
        }
Beispiel #4
0
        void AddStrongConnectedComponent(int vertex, int[] mark, DirectedGraph Graph)
        {
            mark[vertex] = StrongConnectedComponentCount;
            _strongConnectedComponentVertices[StrongConnectedComponentCount].Add(vertex);

            for (int i = 0; i < Graph.GetVertexDegree(vertex); ++i)
            {
                if (mark[Graph.GetEdge(vertex, i).End] == StrongConnectedComponentCount || mark[Graph.GetEdge(vertex, i).End] == -1)
                {
                    _strongConnectedComponentEdges[StrongConnectedComponentCount].Add(Graph.GetEdge(vertex, i).Reverse());
                    if (mark[Graph.GetEdge(vertex, i).End] == -1)
                    {
                        AddStrongConnectedComponent(Graph.GetEdge(vertex, i).End, mark, Graph);
                    }
                }
            }
        }