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

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