| 679 | } |
| 680 | |
| 681 | void OptimizableGraph::addGraph(OptimizableGraph* g){ |
| 682 | for (HyperGraph::VertexIDMap::iterator it=g->vertices().begin(); it!=g->vertices().end(); ++it){ |
| 683 | OptimizableGraph::Vertex* v= (OptimizableGraph::Vertex*)(it->second); |
| 684 | if (vertex(v->id())) |
| 685 | continue; |
| 686 | OptimizableGraph::Vertex* v2=v->clone(); |
| 687 | v2->edges().clear(); |
| 688 | v2->setHessianIndex(-1); |
| 689 | addVertex(v2); |
| 690 | } |
| 691 | for (HyperGraph::EdgeSet::iterator it=g->edges().begin(); it!=g->edges().end(); ++it){ |
| 692 | OptimizableGraph::Edge* e = (OptimizableGraph::Edge*)(*it); |
| 693 | OptimizableGraph::Edge* en = e->clone(); |
| 694 | en->resize(e->vertices().size()); |
| 695 | int cnt = 0; |
| 696 | for (vector<HyperGraph::Vertex*>::const_iterator it = e->vertices().begin(); it != e->vertices().end(); ++it) { |
| 697 | OptimizableGraph::Vertex* v = (OptimizableGraph::Vertex*) vertex((*it)->id()); |
| 698 | assert(v); |
| 699 | en->setVertex(cnt++, v); |
| 700 | } |
| 701 | addEdge(en); |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | int OptimizableGraph::maxDimension() const{ |
| 706 | int maxDim=0; |