/// <summary> /// グラフの深さ優先走査のためのクラスを生成する /// </summary> /// <param name="graph">グラフ</param> /// <param name="vtx">走査開始頂点.nullの場合,走査は先頭の頂点(頂点シーケンスのうち最小のインデックスを持つ頂点)から始まる.</param> /// <param name="mask">イベントマスク.どのイベントにユーザが着目したいのかを指定する.</param> #else /// <summary> /// Creates structure for depth-first graph traversal /// </summary> /// <param name="graph">Graph. </param> /// <param name="vtx">Initial vertex to start from. If NULL, the traversal starts from the first vertex (a vertex with the minimal index in the sequence of vertices). </param> /// <param name="mask">Event mask indicating which events are interesting to the user (where cvNextGraphItem function returns control to the user) It can be CV_GRAPH_ALL_ITEMS (all events are interesting) or combination of the following flags: /// <br/> * CV_GRAPH_VERTEX - stop at the graph vertices visited for the first time /// <br/>* CV_GRAPH_TREE_EDGE - stop at tree edges (tree edge is the edge connecting the last visited vertex and the vertex to be visited next) /// <br/>* CV_GRAPH_BACK_EDGE - stop at back edges (back edge is an edge connecting the last visited vertex with some of its ancestors in the search tree) /// <br/>* CV_GRAPH_FORWARD_EDGE - stop at forward edges (forward edge is an edge conecting the last visited vertex with some of its descendants in the search tree). The forward edges are only possible during oriented graph traversal) /// <br/>* CV_GRAPH_CROSS_EDGE - stop at cross edges (cross edge is an edge connecting different search trees or branches of the same tree. The cross edges are only possible during oriented graphs traversal) /// <br/> * CV_GRAPH_ANY_EDGE - stop and any edge (tree, back, forward and cross edges) /// <br/>* CV_GRAPH_NEW_TREE - stop in the beginning of every new search tree. When the traversal procedure visits all vertices and edges reachible from the initial vertex (the visited vertices together with tree edges make up a tree), it searches for some unvisited vertex in the graph and resumes the traversal process from that vertex. Before starting a new tree (including the very first tree when cvNextGraphItem is called for the first time) it generates CV_GRAPH_NEW_TREE event. /// <br/> For unoriented graphs each search tree corresponds to a connected component of the graph. /// <br/> * CV_GRAPH_BACKTRACKING - stop at every already visited vertex during backtracking - returning to already visited vertexes of the traversal tree.</param> #endif public CvGraphScanner(CvGraph graph, CvGraphVtx vtx, GraphScannerMask mask) : this(CvInvoke.cvCreateGraphScanner(graph.CvPtr, (vtx == null) ? IntPtr.Zero : vtx.CvPtr, mask)) { }
/// <summary> /// グラフの深さ優先走査のためのクラスを生成する /// </summary> /// <param name="graph">グラフ</param> #else /// <summary> /// Creates structure for depth-first graph traversal /// </summary> /// <param name="graph">Graph. </param> #endif public CvGraphScanner(CvGraph graph) : this(graph, null) { }
/// <summary> /// グラフの深さ優先走査のためのクラスを生成する /// </summary> /// <param name="graph">グラフ</param> /// <param name="vtx">走査開始頂点.nullの場合,走査は先頭の頂点(頂点シーケンスのうち最小のインデックスを持つ頂点)から始まる.</param> #else /// <summary> /// Creates structure for depth-first graph traversal /// </summary> /// <param name="graph">Graph. </param> /// <param name="vtx">Initial vertex to start from. If NULL, the traversal starts from the first vertex (a vertex with the minimal index in the sequence of vertices). </param> #endif public CvGraphScanner(CvGraph graph, CvGraphVtx vtx) : this(graph, vtx, GraphScannerMask.AllItems) { }
/// <summary> /// グラフから辺を検出する(ポインタ指定) /// </summary> /// <param name="graph">グラフ. </param> /// <param name="startVtx">辺の始点を示す頂点へのポインタ. </param> /// <param name="endVtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param> /// <returns>指定した二つの頂点を接続する辺</returns> #else /// <summary> /// Finds edge in graph /// </summary> /// <param name="graph">Graph. </param> /// <param name="startVtx">Starting vertex of the edge. </param> /// <param name="endVtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param> /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns> #endif public static CvGraphEdge FindGraphEdgeByPtr(CvGraph graph, CvGraphVtx startVtx, CvGraphVtx endVtx) { if (graph == null) throw new ArgumentNullException("graph"); if (startVtx == null) throw new ArgumentNullException("startVtx"); if (endVtx == null) throw new ArgumentNullException("endVtx"); IntPtr result = NativeMethods.cvFindGraphEdgeByPtr(graph.CvPtr, startVtx.CvPtr, endVtx.CvPtr); if (result == IntPtr.Zero) return null; else return new CvGraphEdge(result); }
/// <summary> /// グラフから辺を検出する(ポインタ指定) /// </summary> /// <param name="graph">グラフ. </param> /// <param name="startVtx">辺の始点を示す頂点へのポインタ. </param> /// <param name="endVtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param> /// <returns>指定した二つの頂点を接続する辺</returns> #else /// <summary> /// Finds edge in graph /// </summary> /// <param name="graph">Graph. </param> /// <param name="startVtx">Starting vertex of the edge. </param> /// <param name="endVtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param> /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns> #endif public static CvGraphEdge GraphFindEdgeByPtr(CvGraph graph, CvGraphVtx startVtx, CvGraphVtx endVtx) { return FindGraphEdgeByPtr(graph, startVtx, endVtx); }
/// <summary> /// グラフから辺を検出する(インデックス指定) /// </summary> /// <param name="graph">グラフ. </param> /// <param name="startIdx">辺の始点を示す頂点のインデックス. </param> /// <param name="endIdx">辺の終点を示す頂点のインデックス.無向グラフの場合,順序はどちらでもよい. </param> /// <returns></returns> #else /// <summary> /// Finds edge in graph /// </summary> /// <param name="graph">Graph. </param> /// <param name="startIdx">Index of the starting vertex of the edge. </param> /// <param name="endIdx">Index of the ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param> /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns> #endif public static CvGraphEdge FindGraphEdge(CvGraph graph, int startIdx, int endIdx) { if (graph == null) { throw new ArgumentNullException("graph"); } IntPtr result = NativeMethods.cvFindGraphEdge(graph.CvPtr, startIdx, endIdx); if (result == IntPtr.Zero) return null; else return new CvGraphEdge(result); }
/// <summary> /// グラフから辺を検出する(インデックス指定) /// </summary> /// <param name="graph">グラフ. </param> /// <param name="startIdx">辺の始点を示す頂点のインデックス. </param> /// <param name="endIdx">辺の終点を示す頂点のインデックス.無向グラフの場合,順序はどちらでもよい. </param> /// <returns></returns> #else /// <summary> /// Finds edge in graph /// </summary> /// <param name="graph">Graph. </param> /// <param name="startIdx">Index of the starting vertex of the edge. </param> /// <param name="endIdx">Index of the ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param> /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns> #endif public static CvGraphEdge GraphFindEdge(CvGraph graph, int startIdx, int endIdx) { return FindGraphEdge(graph, startIdx, endIdx); }
/// <summary> /// グラフの深さ優先走査のためのクラスを生成する /// </summary> /// <param name="graph">グラフ</param> /// <param name="vtx">走査開始頂点.nullの場合,走査は先頭の頂点(頂点シーケンスのうち最小のインデックスを持つ頂点)から始まる.</param> /// <param name="mask">イベントマスク.どのイベントにユーザが着目したいのかを指定する.</param> #else /// <summary> /// Creates structure for depth-first graph traversal /// </summary> /// <param name="graph">Graph. </param> /// <param name="vtx">Initial vertex to start from. If NULL, the traversal starts from the first vertex (a vertex with the minimal index in the sequence of vertices). </param> /// <param name="mask">Event mask indicating which events are interesting to the user (where cvNextGraphItem function returns control to the user) It can be CV_GRAPH_ALL_ITEMS (all events are interesting) or combination of the following flags: /// <br/> * CV_GRAPH_VERTEX - stop at the graph vertices visited for the first time /// <br/>* CV_GRAPH_TREE_EDGE - stop at tree edges (tree edge is the edge connecting the last visited vertex and the vertex to be visited next) /// <br/>* CV_GRAPH_BACK_EDGE - stop at back edges (back edge is an edge connecting the last visited vertex with some of its ancestors in the search tree) /// <br/>* CV_GRAPH_FORWARD_EDGE - stop at forward edges (forward edge is an edge conecting the last visited vertex with some of its descendants in the search tree). The forward edges are only possible during oriented graph traversal) /// <br/>* CV_GRAPH_CROSS_EDGE - stop at cross edges (cross edge is an edge connecting different search trees or branches of the same tree. The cross edges are only possible during oriented graphs traversal) /// <br/> * CV_GRAPH_ANY_EDGE - stop and any edge (tree, back, forward and cross edges) /// <br/>* CV_GRAPH_NEW_TREE - stop in the beginning of every new search tree. When the traversal procedure visits all vertices and edges reachible from the initial vertex (the visited vertices together with tree edges make up a tree), it searches for some unvisited vertex in the graph and resumes the traversal process from that vertex. Before starting a new tree (including the very first tree when cvNextGraphItem is called for the first time) it generates CV_GRAPH_NEW_TREE event. /// <br/> For unoriented graphs each search tree corresponds to a connected component of the graph. /// <br/> * CV_GRAPH_BACKTRACKING - stop at every already visited vertex during backtracking - returning to already visited vertexes of the traversal tree.</param> #endif public CvGraphScanner(CvGraph graph, CvGraphVtx vtx, GraphScannerMask mask) : this(NativeMethods.cvCreateGraphScanner(graph.CvPtr, (vtx == null) ? IntPtr.Zero : vtx.CvPtr, mask)) { }
/// <summary> /// グラフから辺を検出する(ポインタ指定) /// </summary> /// <param name="graph">グラフ. </param> /// <param name="start_vtx">辺の始点を示す頂点へのポインタ. </param> /// <param name="end_vtx">辺の終点を示す頂点へのポインタ.無向グラフの場合,順序はどちらでもよい. </param> /// <returns>指定した二つの頂点を接続する辺</returns> #else /// <summary> /// Finds edge in graph /// </summary> /// <param name="graph">Graph. </param> /// <param name="start_vtx">Starting vertex of the edge. </param> /// <param name="end_vtx">Ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param> /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns> #endif public static CvGraphEdge FindGraphEdgeByPtr(CvGraph graph, CvGraphVtx start_vtx, CvGraphVtx end_vtx) { if (graph == null) { throw new ArgumentNullException("graph"); } if (start_vtx == null) { throw new ArgumentNullException("start_vtx"); } if (end_vtx == null) { throw new ArgumentNullException("end_vtx"); } IntPtr result = CvInvoke.cvFindGraphEdgeByPtr(graph.CvPtr, start_vtx.CvPtr, end_vtx.CvPtr); if (result == IntPtr.Zero) { return null; } else { return new CvGraphEdge(result); } }
/// <summary> /// グラフから辺を検出する(インデックス指定) /// </summary> /// <param name="graph">グラフ. </param> /// <param name="start_idx">辺の始点を示す頂点のインデックス. </param> /// <param name="end_idx">辺の終点を示す頂点のインデックス.無向グラフの場合,順序はどちらでもよい. </param> /// <returns></returns> #else /// <summary> /// Finds edge in graph /// </summary> /// <param name="graph">Graph. </param> /// <param name="start_idx">Index of the starting vertex of the edge. </param> /// <param name="end_idx">Index of the ending vertex of the edge. For unoriented graph the order of the vertex parameters does not matter. </param> /// <returns>The function cvFindGraphEdge finds the graph edge connecting two specified vertices and returns pointer to it or NULL if the edge does not exists.</returns> #endif public static CvGraphEdge FindGraphEdge(CvGraph graph, int start_idx, int end_idx) { if (graph == null) { throw new ArgumentNullException("graph"); } IntPtr result = CvInvoke.cvFindGraphEdge(graph.CvPtr, start_idx, end_idx); if (result == IntPtr.Zero) { return null; } else { return new CvGraphEdge(result); } }