GetEdge() public method

public GetEdge ( int vertex, int edgeIndex ) : DirectedEdge
vertex int
edgeIndex int
return DirectedEdge
Esempio n. 1
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);
        }
Esempio n. 2
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);
                }
        }
Esempio n. 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);
        }
Esempio n. 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);
                    }
                }
            }
        }