Remove a vertex from the graph together with its incident edges: */
| 2630 | |
| 2631 | /* Remove a vertex from the graph together with its incident edges: */ |
| 2632 | CV_IMPL int |
| 2633 | cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx ) |
| 2634 | { |
| 2635 | int count = -1; |
| 2636 | |
| 2637 | if( !graph || !vtx ) |
| 2638 | CV_Error( CV_StsNullPtr, "" ); |
| 2639 | |
| 2640 | if( !CV_IS_SET_ELEM(vtx)) |
| 2641 | CV_Error( CV_StsBadArg, "The vertex does not belong to the graph" ); |
| 2642 | |
| 2643 | count = graph->edges->active_count; |
| 2644 | for( ;; ) |
| 2645 | { |
| 2646 | CvGraphEdge *edge = vtx->first; |
| 2647 | if( !edge ) |
| 2648 | break; |
| 2649 | cvGraphRemoveEdgeByPtr( graph, edge->vtx[0], edge->vtx[1] ); |
| 2650 | } |
| 2651 | count -= graph->edges->active_count; |
| 2652 | cvSetRemoveByPtr( (CvSet*)graph, vtx ); |
| 2653 | |
| 2654 | return count; |
| 2655 | } |
| 2656 | |
| 2657 | |
| 2658 | /* Remove a vertex from the graph together with its incident edges: */ |
no test coverage detected