Lines Matching refs:graph
73 // struct Vertex is used for storing vertices of graph
81 // struct Edge is used for storing edges of graph
167 // function makeGraph creates initial graph to find maximum flow in it
202 CvGraph* graph = *graphPtr;
210 cvGraphAddVtx( graph, NULL, &newVtxPtr );
214 cvGraphAddVtx( graph, NULL, &newVtxPtr );
217 cvGraphAddVtx( graph, NULL, &newVtxPtr );
221 int alphaVtx = graph -> total - 2;
222 int betaVtx = graph -> total - 1;
225 if( graph -> total > 2 )
229 vtxPtr = cvGetGraphVtx( graph, i );
232 cvGraphAddEdge( graph, alphaVtx, i, NULL, &newEdgePtr );
240 CvGraphVtx* tempVtxPtr = cvGetGraphVtx( graph, i - 1 );
251 cvGraphAddEdge( graph, i, i - 1, NULL, &tempEdgePtr );
261 CvGraphVtx* tempVtxPtr = cvGetGraphVtx( graph, i + 1 );
272 cvGraphAddEdge( graph, i, i + 1, NULL, &tempEdgePtr );
287 cvGraphAddEdge( graph, i, betaVtx, NULL, &newEdgePtr );
295 CvGraphVtx* tempVtxPtr = cvGetGraphVtx( graph, i - 1 );
306 CvGraphVtx* tempVtxPtr = cvGetGraphVtx( graph, i + 1 );
322 } /* for( i = 0; i < graph -> total - 2; i ++ ) */
324 } /* if( graph -> total > 2 ) */
333 // function makeHelpGraph creates help graph using initial graph
334 // graph - pointer to initial graph ( represented by CvGraph
336 // hlpGraphPtr - pointer to pointer to new help graph
343 int makeHelpGraph( CvGraph* graph,
354 int s = graph -> total - 2; /* source vertex */
355 int t = graph -> total - 1; /* terminate vertex */
376 for( u = 0; u < graph -> total; u ++ )
380 } /* for( u = 0; u < graph -> total - 1; u ++ ) */
402 CvGraphVtx* graphVtx = cvGetGraphVtx( graph, u );
408 int tempVtxIdx = cvGraphVtxIdx( graph, graphEdge -> vtx[1] );
414 CvGraphEdge* tempGraphEdge = cvFindGraphEdge( graph, u, v );
450 int tempVtxIdx = cvGraphVtxIdx( graph, graphEdge -> vtx[1] );
454 tempVtxIdx = cvGraphVtxIdx( graph, graphEdge -> vtx[0] );
457 CvGraphEdge* tempGraphEdge = cvFindGraphEdge( graph, v, u );
511 // function makePseudoMaxFlow increases flow in graph by using hlpGraph
512 // graph - pointer to initial graph
513 // hlpGraph - pointer to help graph
518 void makePseudoMaxFlow( CvGraph* graph,
536 int s = graph -> total - 2; /* source vertex */
537 int t = graph -> total - 1; /* terminate vertex */
762 cvFindGraphEdge( graph, v, u );
850 cvFindGraphEdge( graph, u, v );
903 CvGraph* graph = NULL;
912 makeGraph( &graph, leftLine, rightLine, alpha, beta, corr, width, storage );
914 int s = graph -> total - 2; /* source vertex - alpha vertex */
915 //int t = graph -> total - 1; /* terminate vertex - beta vertex */
917 int length = makeHelpGraph( graph,
927 makePseudoMaxFlow( graph,
934 length = makeHelpGraph( graph,
947 CvGraphEdge* graphEdge = cvFindGraphEdge( graph, s, i );
952 graphVtx = cvGetGraphVtx( graph, i );
964 graphVtx = cvGetGraphVtx( graph, i );
978 cvClearGraph( graph );