ORTHO_DRAW()
Example
|
Let We first generate a random planar graph |
|
Then we define Using these parameters we call |
#include <LEDA/graph/graph.h> #include <LEDA/graph/graph_draw.h> #include <LEDA/graphics/graphwin.h> #include <LEDA/graph/node_array.h> #include <LEDA/graph/edge_array.h> #include <LEDA/corlist.h> using namespace leda; int main() { graph G; random_planar_graph(G,10,20); Make_Connected(G); list<edge> dummy_edges; Make_Bidirected(G,dummy_edges); G.make_planar_map(); node_array<double> xpos(G), ypos(G); node_array<double> xrad(G), yrad(G); edge_array<list<double> > xbends(G), ybends(G); edge_array<double> xsanch(G), ysanch(G); edge_array<double> xtanch(G), ytanch(G); bool feasible=ORTHO_DRAW(G,xpos,ypos,xrad,yrad,xbends,ybends, xsanch,ysanch,xtanch,ytanch); if (feasible) { edge e; forall(e,dummy_edges) G.del_edge(e); GraphWin gw(G); gw.set_node_shape(rectangle_node); gw.set_node_color(red); double dx,dy,f; gw.fill_win_params(xpos,ypos,xbends,ybends,dx,dy,f,f); gw.transform_layout(xpos,ypos,xbends,ybends,dx,dy,f,f); node v; forall_nodes(v,G) {xrad[v] *= f;yrad[v] *= f;} gw.set_layout(xpos,ypos,xrad,yrad,xbends,ybends, xsanch,ysanch,xtanch,ytanch); gw.open(); gw.display(); } else std::cout << "No corresponding embedding possible!" << std::endl; return 0; }
Manual Entries:
Manual Page Graph Drawing Algorithms
Algorithmic Solutions Software GmbH