home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / leda / prog / graph / embeddin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  416 b   |  33 lines

  1. #include <LEDA/graph.h>
  2. #include <LEDA/graph_alg.h>
  3.  
  4. declare2(GRAPH,int,int)
  5.  
  6. main()
  7. {
  8. GRAPH(int,int) G;
  9.  
  10. cout << "Give a planar graph.\n";
  11.  
  12. test_graph(G);
  13.  
  14. if ( ! PLANAR(G) )
  15.  { cout << "Graph is not planar\n";
  16.    exit(1);
  17.   }
  18.  
  19. if (Yes("print planar map ? "))  G.print();
  20.  
  21.  
  22. node v;
  23.  
  24.  
  25. node_array(int) x(G),y(G);
  26.  
  27. STRAIGHT_LINE_EMBEDDING(G,x,y);
  28.  
  29. forall_nodes(v,G) cout << form("x = %2d    y = %2d\n",x[v],y[v]);
  30.  
  31.  
  32. }
  33.