Remove a vertex from the graph together with its incident edges: */
| 2657 | |
| 2658 | /* Remove a vertex from the graph together with its incident edges: */ |
| 2659 | CV_IMPL int |
| 2660 | cvGraphRemoveVtx( CvGraph* graph, int index ) |
| 2661 | { |
| 2662 | int count = -1; |
| 2663 | CvGraphVtx *vtx = 0; |
| 2664 | |
| 2665 | if( !graph ) |
| 2666 | CV_Error( CV_StsNullPtr, "" ); |
| 2667 | |
| 2668 | vtx = cvGetGraphVtx( graph, index ); |
| 2669 | if( !vtx ) |
| 2670 | CV_Error( CV_StsBadArg, "The vertex is not found" ); |
| 2671 | |
| 2672 | count = graph->edges->active_count; |
| 2673 | for( ;; ) |
| 2674 | { |
| 2675 | CvGraphEdge *edge = vtx->first; |
| 2676 | count++; |
| 2677 | |
| 2678 | if( !edge ) |
| 2679 | break; |
| 2680 | cvGraphRemoveEdgeByPtr( graph, edge->vtx[0], edge->vtx[1] ); |
| 2681 | } |
| 2682 | count -= graph->edges->active_count; |
| 2683 | cvSetRemoveByPtr( (CvSet*)graph, vtx ); |
| 2684 | |
| 2685 | return count; |
| 2686 | } |
| 2687 | |
| 2688 | |
| 2689 | /* Find a graph edge given pointers to the ending vertices: */ |
nothing calls this directly
no test coverage detected