Boost C++ Libraries: Ticket #6573: BGL: boost::isomorphism routine fails with large graphs https://svn.boost.org/trac10/ticket/6573 <p> I am not sure maybe this is a "known" limitation of the isomorphism routine. My test graphs are graphs of wire frames of polyhedra. (Vertices of a polyhedron are the vertices of the graph, edges of the polyhedron are the edges of the graph.) The test graphs are generated from simple "faceted cylinders", i.e. the top and the bottom of the polyhedron (a slab/column) are polygons with the same number of sides (3,4,5...) and the same number of facets between the top and the bottom polygons. So if the number of sides is 3 then the number of vertices is 6 and the number of edges is 9 (6,9), if the number of sides is 4 then the number of vertices/edges is (8,12), for a polyhedron with 'n' number of sides the number of vertices/edges are (2n,3n). </p> <p> With large number of sides the isomorphism routine between two identical graphs fails with what is in the debugger looks like an infinite recursion. The number of sides where it fails varies from platform/architecture and compiler. For example on Windows with MSVC8 the first failure happens when the number of sides is 58 in 64bit/debug 138 in 64bit/optimize 140 in 32bit/debug and at 495 in 32bit/optimize. (Results with Intel compiler 11.1 are even poorer, it crashes with smaller sizes already.) On RHEL4 (32bit/gcc4.1.2) it crashed when the number of sides reached 4096, on RHEL5 (64bit/gcc4.1.2) it crashed at 8192 (didn't attempt to find the smallest number of sides where it still succeeds for that configuration). </p> <p> I am attaching the Makefile-s that I am using on Windows and Linux, the problem is also reproducible with a standard Visual Studio project, in addition to the default setup only the include path to boost needs to be set. </p> <p> Any help/hint is appreciated. Thank you. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6573 Trac 1.4.3 Andras Pap <andraspap@…> Fri, 17 Feb 2012 19:13:40 GMT attachment set https://svn.boost.org/trac10/ticket/6573 https://svn.boost.org/trac10/ticket/6573 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">SimpleGraphTest.cpp</span> </li> </ul> Ticket Andras Pap <andraspap@…> Fri, 17 Feb 2012 19:13:55 GMT attachment set https://svn.boost.org/trac10/ticket/6573 https://svn.boost.org/trac10/ticket/6573 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">Makefile.NT40</span> </li> </ul> Ticket Andras Pap <andraspap@…> Fri, 17 Feb 2012 19:14:11 GMT attachment set https://svn.boost.org/trac10/ticket/6573 https://svn.boost.org/trac10/ticket/6573 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">Makefile.linux</span> </li> </ul> Ticket Jeremiah Willcock Fri, 17 Feb 2012 19:42:55 GMT status changed https://svn.boost.org/trac10/ticket/6573#comment:1 https://svn.boost.org/trac10/ticket/6573#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> I can reproduce the problem with your test code; it seems to be a too-deep recursion when the graph gets large. I'll try to fix it, but it looks complicated to do and I probably won't be able to get to it for a few days. </p> Ticket Andras Pap <andraspap@…> Fri, 24 Feb 2012 13:42:57 GMT <link>https://svn.boost.org/trac10/ticket/6573#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6573#comment:2</guid> <description> <p> Thank you very much for your immediate response. I would be happy to look into this issue if you could give me some pointers to the possible source of the problem or a hint for a possible solution/workaround. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jeremiah Willcock</dc:creator> <pubDate>Fri, 24 Feb 2012 14:35:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6573#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6573#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/6573#comment:2" title="Comment 2">Andras Pap &lt;andraspap@…&gt;</a>: </p> <blockquote class="citation"> <p> Thank you very much for your immediate response. I would be happy to look into this issue if you could give me some pointers to the possible source of the problem or a hint for a possible solution/workaround. </p> </blockquote> <p> The problem is <code>isomorphism_algo::match</code> in <code>&lt;boost/graph/isomorphism.hpp&gt;</code>. That function contains a recursion-based DFS that will overflow the stack for large graphs. It should be using the BGL DFS algorithm or an explicit stack that will not cause the system stack to overflow. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jeremiah Willcock</dc:creator> <pubDate>Sat, 03 Mar 2012 20:02:30 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6573#comment:4 https://svn.boost.org/trac10/ticket/6573#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/77185" title="Changed to trampolined implementation of match() to avoid stack ...">[77185]</a>) Changed to trampolined implementation of match() to avoid stack overflows, now passes test case in <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6573" title="#6573: Bugs: BGL: boost::isomorphism routine fails with large graphs (closed: fixed)">#6573</a> with 10000 sides; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6573" title="#6573: Bugs: BGL: boost::isomorphism routine fails with large graphs (closed: fixed)">#6573</a> </p> Ticket Andras Pap <andraspap@…> Mon, 05 Mar 2012 22:01:34 GMT <link>https://svn.boost.org/trac10/ticket/6573#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6573#comment:5</guid> <description> <p> Thank you very much for the fix, it works great. </p> </description> <category>Ticket</category> </item> </channel> </rss>