<div dir="ltr">This looks to be a bug in lemon. If you need a quick workaround, then pass an embedding to the run() function, like here:<div><a href="http://lemon.cs.elte.hu/trac/lemon/browser/lemon/test/planarity_test.cc#L249">http://lemon.cs.elte.hu/trac/lemon/browser/lemon/test/planarity_test.cc#L249</a><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 15, 2018 at 1:38 PM Szabolcs Horvát <<a href="mailto:szhorvat@gmail.com">szhorvat@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello everyone,<div><br></div><div>I am new to Lemon, and I am trying to construct a PlanarDrawing of a graph.</div><div><br></div><div>It's not working, and I'm not quite sure what I am doing wrong. The analogous way of using PlanarEmbedding worked fine.</div><div><br></div><div>Here's a minimal example (to be compiled as C++11):</div><div><br></div><div>

<pre style="margin:0px;text-indent:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><lemon/static_graph.h></span></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><lemon/planarity.h></span></pre> <pre style="margin:0px;text-indent:0px"><br></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><utility></span></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><vector></span></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><iostream></span></pre> <pre style="margin:0px;text-indent:0px"><br></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(128,128,0)">using</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">namespace</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">lemon</span>;</pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(128,128,0)">using</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">namespace</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span>;</pre> <pre style="margin:0px;text-indent:0px"><br></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="font-weight:600;color:rgb(0,103,124)">main</span>()<span style="color:rgb(192,192,192)"> </span>{</pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">StaticDigraph</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">digraph</span>;</pre> <pre style="margin:0px;text-indent:0px"><br></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">vector</span><<span style="color:rgb(128,0,128)">pair</span><<span style="color:rgb(128,128,0)">int</span>,<span style="color:rgb(128,128,0)">int</span>>><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">edges</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>{{<span style="color:rgb(0,0,128)">0</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">1</span>},<span style="color:rgb(192,192,192)"> </span>{<span style="color:rgb(0,0,128)">0</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">2</span>},<span style="color:rgb(192,192,192)"> </span>{<span style="color:rgb(0,0,128)">1</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">2</span>}};<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">already</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">sorted</span></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(9,46,100)">digraph</span>.<span style="color:rgb(0,103,124)">build</span>(<span style="color:rgb(0,0,128)">3</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">edges</span>.<span style="color:rgb(0,103,124)">begin</span>(),<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">edges</span>.<span style="color:rgb(0,103,124)">end</span>());</pre> <pre style="margin:0px;text-indent:0px"><br></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Undirector</span><<span style="color:rgb(128,0,128)">StaticDigraph</span>><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Graph</span>;</pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">Graph</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">graph</span><span style="color:rgb(192,192,192)"> </span>(<span style="color:rgb(9,46,100)">digraph</span>);</pre> <pre style="margin:0px;text-indent:0px"><br></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">PlanarDrawing</span><<span style="color:rgb(128,0,128)">Graph</span>><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">drawing</span>(<span style="color:rgb(9,46,100)">graph</span>);</pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(9,46,100)">drawing</span>.<span style="color:rgb(0,103,124)">run</span>();</pre> <pre style="margin:0px;text-indent:0px"><br></pre> <pre style="margin:0px;text-indent:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span>;</pre> <pre style="margin:0px;text-indent:0px">}</pre><br></div><div>The error I get is:</div><div><br></div><font face="monospace, monospace">type </font><span style="font-family:monospace,monospace">'const lemon::PlanarEmbedding<lemon::Undirector<lemon::StaticDigraph> >' does not provide a subscript operator</span><div><font face="monospace, monospace"><br>          Arc ee = embedding[_graph.direct(e, true)];</font></div><div><font face="monospace, monospace"><br></font></div>I'm not quite sure what to make of it.<div><br></div><div>Can anyone point out my mistake?</div><div><br></div><div>Best regards,</div><div>Szabolcs</div></div>
_______________________________________________<br>
Lemon-user mailing list<br>
<a href="mailto:Lemon-user@lemon.cs.elte.hu" target="_blank">Lemon-user@lemon.cs.elte.hu</a><br>
<a href="http://lemon.cs.elte.hu/mailman/listinfo/lemon-user" rel="noreferrer" target="_blank">http://lemon.cs.elte.hu/mailman/listinfo/lemon-user</a><br>
</blockquote></div>