Add a vertex to a graph: */
| 2604 | |
| 2605 | /* Add a vertex to a graph: */ |
| 2606 | CV_IMPL int |
| 2607 | cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* _vertex, CvGraphVtx** _inserted_vertex ) |
| 2608 | { |
| 2609 | CvGraphVtx *vertex = 0; |
| 2610 | int index = -1; |
| 2611 | |
| 2612 | if( !graph ) |
| 2613 | CV_Error( CV_StsNullPtr, "" ); |
| 2614 | |
| 2615 | vertex = (CvGraphVtx*)cvSetNew((CvSet*)graph); |
| 2616 | if( vertex ) |
| 2617 | { |
| 2618 | if( _vertex ) |
| 2619 | memcpy( vertex + 1, _vertex + 1, graph->elem_size - sizeof(CvGraphVtx) ); |
| 2620 | vertex->first = 0; |
| 2621 | index = vertex->flags; |
| 2622 | } |
| 2623 | |
| 2624 | if( _inserted_vertex ) |
| 2625 | *_inserted_vertex = vertex; |
| 2626 | |
| 2627 | return index; |
| 2628 | } |
| 2629 | |
| 2630 | |
| 2631 | /* Remove a vertex from the graph together with its incident edges: */ |
no test coverage detected