MCPcopy Create free account
hub / github.com/creatale/node-dv / cvGraphRemoveVtx

Function cvGraphRemoveVtx

deps/opencv/modules/core/src/datastructs.cpp:2659–2686  ·  view source on GitHub ↗

Remove a vertex from the graph together with its incident edges: */

Source from the content-addressed store, hash-verified

2657
2658/* Remove a vertex from the graph together with its incident edges: */
2659CV_IMPL int
2660cvGraphRemoveVtx( 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: */

Callers

nothing calls this directly

Calls 2

cvGraphRemoveEdgeByPtrFunction · 0.85
cvSetRemoveByPtrFunction · 0.85

Tested by

no test coverage detected