I have filed a bug with a patch. https://lemon.cs.elte.hu/trac/lemon/ticket/611
On Tue, May 15, 2018 at 4:16 PM Szabolcs Horvát <szhor...@gmail.com> wrote: > I think I found another problem. Running the drawing algorithm on a graph > with no edges and less than 3 vertices causes a crash. Of course, it is > easy to work around this. But it would be nice to have it fixed. > > Minimal example with the singleton graph: > > > #include <lemon/static_graph.h> > > #include <lemon/planarity.h> > > > #include <utility> > > #include <vector> > > > using namespace lemon; > > using namespace std; > > > int main() { > > > StaticDigraph digraph; > > > vector<pair<int,int>> edges = {}; // already sorted > > digraph.build(1, edges.begin(), edges.end()); > > > typedef Undirector<StaticDigraph> Graph; > > Graph graph(digraph); > > > PlanarEmbedding<Graph> embedding(graph); > > embedding.run(false); > > > PlanarDrawing<Graph> drawing(graph); > > drawing.run(embedding.embeddingMap()); > > > return 0; > > } > > > > > On Tue, 15 May 2018 at 14:40, Szabolcs Horvát <szhor...@gmail.com> wrote: > >> Thanks for the clarification Balázs! >> >> On Tue, 15 May 2018 at 14:21, Balázs Dezső <deba...@gmail.com> wrote: >> >>> I have also filed a bug and created a patch: >>> http://lemon.cs.elte.hu/trac/lemon/ticket/610 >>> >>> On Tue, May 15, 2018 at 2:02 PM Balázs Dezső <deba...@gmail.com> wrote: >>> >>>> This looks to be a bug in lemon. If you need a quick workaround, then >>>> pass an embedding to the run() function, like here: >>>> >>>> http://lemon.cs.elte.hu/trac/lemon/browser/lemon/test/planarity_test.cc#L249 >>>> >>>> On Tue, May 15, 2018 at 1:38 PM Szabolcs Horvát <szhor...@gmail.com> >>>> wrote: >>>> >>>>> Hello everyone, >>>>> >>>>> I am new to Lemon, and I am trying to construct a PlanarDrawing of a >>>>> graph. >>>>> >>>>> It's not working, and I'm not quite sure what I am doing wrong. The >>>>> analogous way of using PlanarEmbedding worked fine. >>>>> >>>>> Here's a minimal example (to be compiled as C++11): >>>>> >>>>> #include <lemon/static_graph.h> >>>>> >>>>> #include <lemon/planarity.h> >>>>> >>>>> >>>>> #include <utility> >>>>> >>>>> #include <vector> >>>>> >>>>> #include <iostream> >>>>> >>>>> >>>>> using namespace lemon; >>>>> >>>>> using namespace std; >>>>> >>>>> >>>>> int main() { >>>>> >>>>> StaticDigraph digraph; >>>>> >>>>> >>>>> vector<pair<int,int>> edges = {{0, 1}, {0, 2}, {1, 2}}; // already >>>>> sorted >>>>> >>>>> digraph.build(3, edges.begin(), edges.end()); >>>>> >>>>> >>>>> typedef Undirector<StaticDigraph> Graph; >>>>> >>>>> Graph graph (digraph); >>>>> >>>>> >>>>> PlanarDrawing<Graph> drawing(graph); >>>>> >>>>> drawing.run(); >>>>> >>>>> >>>>> return 0; >>>>> >>>>> } >>>>> >>>>> >>>>> The error I get is: >>>>> >>>>> type 'const >>>>> lemon::PlanarEmbedding<lemon::Undirector<lemon::StaticDigraph> >' does not >>>>> provide a subscript operator >>>>> >>>>> Arc ee = embedding[_graph.direct(e, true)]; >>>>> >>>>> I'm not quite sure what to make of it. >>>>> >>>>> Can anyone point out my mistake? >>>>> >>>>> Best regards, >>>>> Szabolcs >>>>> _______________________________________________ >>>>> Lemon-user mailing list >>>>> Lemon-user@lemon.cs.elte.hu >>>>> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user >>>>> >>>> _______________________________________________ > Lemon-user mailing list > Lemon-user@lemon.cs.elte.hu > http://lemon.cs.elte.hu/mailman/listinfo/lemon-user >
_______________________________________________ Lemon-user mailing list Lemon-user@lemon.cs.elte.hu http://lemon.cs.elte.hu/mailman/listinfo/lemon-user