[Lemon-user] planar embedding

Alpár Jüttner alpar at cs.elte.hu
Sat Feb 4 09:55:43 CET 2012


Dear Ello,

In order to check planarity, you should use PlanarEmbedding<> or
checkPlanarity() instead.

If you need the actual drawing, you must first use PlanarEmbedding to
obtain an ordering of the edges then feed PlanarDrawing with that data:

  PlanarEmbedding<ListGraph> pe(g);
  PlanarDrawing<ListGraph> pd(g);
  bool planar = pe.run();
  if(planar) {
    pd.run(pe.embeddingMap());
  }

I hope this helps.

Regards,
Alpar


On Sat, 2012-01-28 at 09:02 -0800, Bgh Ello wrote:
> Dear sirs,
> 
> 
>      I am having a hard time with what seems to me should be a simple
> matter.  I have your latest (hg) version
> of lemon, and would like to obtain some drawings of planar graphs.
> The following is my attempt at just getting the
> planar embedding of a simple two-vertex graph.  When trying to
> compile, this gives a long sequence of error
> messages.  I've tried changing the template argument, but no luck.
> It's probably really simple, but if you could
> help me get this to work, it would be most appreciated.
> 
> 
>      Thanks.
> 
> 
>            Ello
> 
> 
> ---------------------------
> 
> 
> 
> #include <iostream>
> #include <lemon/list_graph.h>
> #include <lemon/planarity.h>
> 
> using namespace lemon;
> using namespace std;
> 
> int main()
> {
>   ListGraph g;
> 
>   ListGraph::Node u = g.addNode();
>   ListGraph::Node v = g.addNode();
>   ListGraph::Edge  a = g.addEdge(u, v);
> 
>   cout << "Hello World! This is LEMON library here." << endl;
>   cout << "We have a graph with " << countNodes(g) << " nodes "
>        << "and " << countEdges(g) << " edges." << endl;
> 
>   PlanarDrawing<ListGraph> p(g);
>   bool planar = p.run();
>   if (planar)
>      cout << "Planar" << endl;
>   else
>      cout << "Non-planar" << endl;
> 
> //  Next, get coords of vertices.
> 
>   return 0;
> }
> 
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user





More information about the Lemon-user mailing list