[Graph] Issue with is_straight_line_drawing?
Hi,
I'm concerned about the output I'm getting from the
is_straight_line_drawing function in the Boost Graph library. My
understanding was that it should report true when the graph and
positions are a planar embedding (no edge crossings).
Based on this understanding, I thought the code listed at the end of
the message should say that the drawing for a clique on 4 vertices,
with positions on a square, is not planar (see the picture below).
This arrangement has one edge crossing. The function outputs that the
graph is a plane drawing.
Did I misunderstand what the is_straight_line_drawing function is
supposed to do?
Thanks,
David Gleich
#include <iostream>
#include
straight_line_drawing_t; straight_line_drawing_storage_t straight_line_drawing_storage (num_vertices(g)); straight_line_drawing_t straight_line_drawing (straight_line_drawing_storage.begin(), get(vertex_index,g) ); /* should be 0 / | \ 3--|--1 \ | / 2 which is not a plane drawing. */ straight_line_drawing[0].x = 1; straight_line_drawing[0].y = 2; straight_line_drawing[1].x = 2; straight_line_drawing[1].y = 1; straight_line_drawing[2].x = 1; straight_line_drawing[2].y = 0; straight_line_drawing[3].x = 0; straight_line_drawing[3].y = 1; if (is_straight_line_drawing(g, straight_line_drawing)) std::cout << "Is a plane drawing." << std::endl; else std::cout << "Is not a plane drawing." << std::endl; return 0; } /* Compiling and example $ g++ -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7) $g++ is_straight_line_drawing.cpp -I/home/dgleich/dev/lib/boost_1_36_0/ $./a.out Is a plane drawing. Should be Is not a plane drawing. */
On Thu, Oct 2, 2008 at 3:00 PM, David Gleich
Hi,
I'm concerned about the output I'm getting from the is_straight_line_drawing function in the Boost Graph library. My understanding was that it should report true when the graph and positions are a planar embedding (no edge crossings).
Based on this understanding, I thought the code listed at the end of the message should say that the drawing for a clique on 4 vertices, with positions on a square, is not planar (see the picture below). This arrangement has one edge crossing. The function outputs that the graph is a plane drawing.
Did I misunderstand what the is_straight_line_drawing function is supposed to do?
Thanks, David Gleich
<snip>
/* should be 0 / | \ 3--|--1 \ | / 2 which is not a plane drawing. */
<snip> Hi David, You're right - this looks like a bug in is_straight_line_drawing. The sweep of the plane isn't comparing the two perpendicular edges (0,2) and (1,3), which intersect. I'll look at the code a little more closely this weekend and see if I can't come up with a fix. Regards, Aaron
On Fri, Oct 3, 2008 at 9:08 AM, Aaron Windsor
On Thu, Oct 2, 2008 at 3:00 PM, David Gleich
wrote: Hi,
I'm concerned about the output I'm getting from the is_straight_line_drawing function in the Boost Graph library. My understanding was that it should report true when the graph and positions are a planar embedding (no edge crossings).
Based on this understanding, I thought the code listed at the end of the message should say that the drawing for a clique on 4 vertices, with positions on a square, is not planar (see the picture below). This arrangement has one edge crossing. The function outputs that the graph is a plane drawing.
Did I misunderstand what the is_straight_line_drawing function is supposed to do?
Thanks, David Gleich
<snip>
/* should be 0 / | \ 3--|--1 \ | / 2 which is not a plane drawing. */
<snip>
Hi David,
You're right - this looks like a bug in is_straight_line_drawing. The sweep of the plane isn't comparing the two perpendicular edges (0,2) and (1,3), which intersect. I'll look at the code a little more closely this weekend and see if I can't come up with a fix.
Regards, Aaron
Hi David, I just committed a fix for this bug to trunk - an additional comparison was needed at each event point during the sweep of the plane. Let me know if you'd like a patch. Regards, Aaron
Aaron Windsor
I just committed a fix for this bug to trunk - an additional comparison was needed at each event point during the sweep of the plane. Let me know if you'd like a patch.
Aaron: Many thanks for addressing the bug so promptly. I'd appreciate a patch if it isn't too much trouble. Thanks again, David
On Sun, Oct 5, 2008 at 4:25 PM, David Gleich
Aaron Windsor
writes: I just committed a fix for this bug to trunk - an additional comparison was needed at each event point during the sweep of the plane. Let me know if you'd like a patch.
Aaron:
Many thanks for addressing the bug so promptly.
I'd appreciate a patch if it isn't too much trouble.
Hi David, The patch attached should work against boost 1.35 or 1.36. Thanks for reporting the bug! Aaron
participants (2)
-
Aaron Windsor
-
David Gleich