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

Function cvNextGraphItem

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

Source from the content-addressed store, hash-verified

3087
3088
3089CV_IMPL int
3090cvNextGraphItem( CvGraphScanner* scanner )
3091{
3092 int code = -1;
3093 CvGraphVtx* vtx;
3094 CvGraphVtx* dst;
3095 CvGraphEdge* edge;
3096 CvGraphItem item;
3097
3098 if( !scanner || !(scanner->stack))
3099 CV_Error( CV_StsNullPtr, "Null graph scanner" );
3100
3101 dst = scanner->dst;
3102 vtx = scanner->vtx;
3103 edge = scanner->edge;
3104
3105 for(;;)
3106 {
3107 for(;;)
3108 {
3109 if( dst && !CV_IS_GRAPH_VERTEX_VISITED(dst) )
3110 {
3111 scanner->vtx = vtx = dst;
3112 edge = vtx->first;
3113 dst->flags |= CV_GRAPH_ITEM_VISITED_FLAG;
3114
3115 if((scanner->mask & CV_GRAPH_VERTEX))
3116 {
3117 scanner->vtx = vtx;
3118 scanner->edge = vtx->first;
3119 scanner->dst = 0;
3120 code = CV_GRAPH_VERTEX;
3121 return code;
3122 }
3123 }
3124
3125 while( edge )
3126 {
3127 dst = edge->vtx[vtx == edge->vtx[0]];
3128
3129 if( !CV_IS_GRAPH_EDGE_VISITED(edge) )
3130 {
3131 // Check that the edge is outgoing:
3132 if( !CV_IS_GRAPH_ORIENTED( scanner->graph ) || dst != edge->vtx[0] )
3133 {
3134 edge->flags |= CV_GRAPH_ITEM_VISITED_FLAG;
3135
3136 if( !CV_IS_GRAPH_VERTEX_VISITED(dst) )
3137 {
3138 item.vtx = vtx;
3139 item.edge = edge;
3140
3141 vtx->flags |= CV_GRAPH_SEARCH_TREE_NODE_FLAG;
3142
3143 cvSeqPush( scanner->stack, &item );
3144
3145 if( scanner->mask & CV_GRAPH_TREE_EDGE )
3146 {

Callers 1

core_c.hFile · 0.85

Calls 3

cvSeqPushFunction · 0.85
cvSeqPopFunction · 0.85
icvSeqFindNextElemFunction · 0.85

Tested by

no test coverage detected