Boost C++ Libraries: Ticket #11804: Contribution: edge-disjoint k-shortest paths https://svn.boost.org/trac10/ticket/11804 <p> Hi, </p> <p> I want to contribute a function that calculates edge-disjoint k-shortest paths. </p> <p> The algorithm searches for a shortest path. Then it disables the edges of the shortest path, and repeats the search. On so on, until no path can be found. </p> <p> I'm attaching the source file and a unit test. </p> <p> There are two things that bug me in the code: </p> <ul><li>the predecessor map is hardcoded as: </li></ul><blockquote> <p> boost::vector_property_map&lt;edge_descriptor&gt; pred(num_vertices(g)); </p> </blockquote> <blockquote> <p> while perhaps it should depend on the graph type, </p> </blockquote> <ul><li>the formatting of this call is ugly: </li></ul><blockquote> <p> boost::dijkstra_shortest_paths </p> <blockquote> <p> (fg, s, </p> <blockquote> <p> visitor(make_dijkstra_visitor(record_edge_predecessors(pred, on_edge_relaxed())))); </p> </blockquote> </blockquote> </blockquote> <p> I would appreciate it, if someone could give me a hint on these two problems. </p> <p> I would also appreciate very much any comments and improvements. </p> <p> Thanks! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11804 Trac 1.4.3 Irek Szcześniak <irek@…> Wed, 18 Nov 2015 22:05:09 GMT attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.hpp</span> </li> </ul> <p> the implementation </p> Ticket Irek Szcześniak <irek@…> Wed, 18 Nov 2015 22:05:33 GMT attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.cc</span> </li> </ul> <p> the unit test </p> Ticket Irek Szcześniak <irek@…> Mon, 23 Nov 2015 11:04:47 GMT attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.2.hpp</span> </li> </ul> <p> the implementation - v2 </p> Ticket Irek Szcześniak <irek@…> Mon, 23 Nov 2015 11:05:24 GMT attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.2.cc</span> </li> </ul> <p> the unit test - v2 </p> Ticket Irek Szcześniak <irek@…> Mon, 23 Nov 2015 11:09:54 GMT <link>https://svn.boost.org/trac10/ticket/11804#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11804#comment:1</guid> <description> <p> I attached the second version of the implementation and the unit test. Now the function returns its results in a list, not in a multiset anymore. </p> </description> <category>Ticket</category> </item> <item> <author>Irek Szcześniak <irek@…></author> <pubDate>Mon, 23 Nov 2015 11:20:28 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11804#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11804#comment:2</guid> <description> <p> The reasoning for the used data types: </p> <ul><li>the excluded edges are stored in a set in edksp_filter, to make sure that the edge lookup is fast, </li></ul><ul><li>the path is a list (and not a vector), because the length of the path is not known up front (building a path as a vector could resize the vector), and the paths are not expected to be heavily used to merit the use of a vector, </li></ul><ul><li>for the same reasons as for a path, the found paths are returned in a list, not a vector. </li></ul> </description> <category>Ticket</category> </item> <item> <author>Irek Szcześniak <irek@…></author> <pubDate>Thu, 03 Dec 2015 08:10:03 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.3.hpp</span> </li> </ul> Ticket Irek Szcześniak <irek@…> Thu, 03 Dec 2015 08:10:33 GMT attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.3.cc</span> </li> </ul> <p> the unit test - v3 </p> Ticket Irek Szcześniak <irek@…> Thu, 03 Dec 2015 08:23:32 GMT <link>https://svn.boost.org/trac10/ticket/11804#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11804#comment:3</guid> <description> <p> I attached the third version of the implementation and the unit test. This revision has a number of changes: </p> <ul><li>bug fix: the Dijkstra call is using the right property map (wm), and not the graph's built in, </li></ul><ul><li>new feature: the user is allowed to provide an optional argument K, which limits the search to at most K shortest paths, </li></ul><ul><li>performance improvement: the Dijkstra search is stopped as soon as the shortest path to the destination vertex is found, </li></ul><ul><li>added more comments, </li></ul><ul><li>moved the call to Dijkstra to a separate function, and made the call well-formatted (i.e., it's not very long). </li></ul> </description> <category>Ticket</category> </item> <item> <author>Irek Szcześniak <irek@…></author> <pubDate>Tue, 08 Dec 2015 09:07:09 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.4.hpp</span> </li> </ul> <p> the implementation - v4 </p> Ticket Irek Szcześniak <irek@…> Tue, 08 Dec 2015 09:08:38 GMT attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">custom_dijkstra_call.hpp</span> </li> </ul> <p> the implementation of the custom dijkstra call - v1 </p> Ticket Irek Szcześniak <irek@…> Tue, 08 Dec 2015 09:09:21 GMT attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">exclude_filter.hpp</span> </li> </ul> <p> the implementation of the exclude filter - v1 </p> Ticket Irek Szcześniak <irek@…> Tue, 08 Dec 2015 09:10:51 GMT <link>https://svn.boost.org/trac10/ticket/11804#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11804#comment:4</guid> <description> <p> Made the implementation more generic by allowing a user to provide the vector index map. I also moved the implementation of the exclude filter and the custom dijkstra call to separate files. </p> </description> <category>Ticket</category> </item> <item> <author>Irek Szcześniak <irek@…></author> <pubDate>Tue, 08 Dec 2015 09:12:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11804#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11804#comment:5</guid> <description> <p> Thanks to Daniel Hofmann for his advice on how to better call the Dijkstra function, i.e. to use the iterator_property_map, and to let the user provide the vector index map. Many thanks! </p> </description> <category>Ticket</category> </item> <item> <author>Irek Szcześniak <irek@…></author> <pubDate>Tue, 08 Dec 2015 09:37:28 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.5.hpp</span> </li> </ul> <p> the implementation - v5 </p> Ticket Irek Szcześniak <irek@…> Tue, 08 Dec 2015 09:37:51 GMT attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">custom_dijkstra_call.2.hpp</span> </li> </ul> <p> the implementation of the custom dijkstra call - v2 </p> Ticket Irek Szcześniak <irek@…> Tue, 08 Dec 2015 09:39:38 GMT <link>https://svn.boost.org/trac10/ticket/11804#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11804#comment:6</guid> <description> <p> In revisions just added (edge_disjoint_ksp.5.hpp and custom_dijkstra_call.2.hpp), I only cleaned up the inclusion of header files. </p> </description> <category>Ticket</category> </item> <item> <author>Irek Szcześniak <irek@…></author> <pubDate>Wed, 09 Dec 2015 09:52:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11804#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11804#comment:7</guid> <description> <p> I would appreciate some advice on what I should do next to contribute this code. Please let me know. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 14 Mar 2016 21:13:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11804#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11804#comment:8</guid> <description> <p> Compile the unit test like this: </p> <pre class="wiki">g++ -std=c++11 edge_disjoint_ksp.cc -l boost_unit_test_framework -l boost_test_exec_monitor -o edge_disjoint_ksp </pre> </description> <category>Ticket</category> </item> <item> <author>Irek Szcześniak <irek@…></author> <pubDate>Mon, 14 Mar 2016 21:26:19 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.6.hpp</span> </li> </ul> <p> the implementation - v6 </p> Ticket Irek Szcześniak <irek@…> Mon, 14 Mar 2016 21:26:57 GMT attachment set https://svn.boost.org/trac10/ticket/11804 https://svn.boost.org/trac10/ticket/11804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">edge_disjoint_ksp.4.cc</span> </li> </ul> <p> the unit test - v4 </p> Ticket Irek Szcześniak <irek@…> Mon, 14 Mar 2016 21:29:25 GMT <link>https://svn.boost.org/trac10/ticket/11804#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11804#comment:9</guid> <description> <p> I added a simplified implementation and a modified unit test. This implementation does not use the exclude_filter.hpp, which I implemented. Instead, we use the filter provided by the filtered_graph. </p> </description> <category>Ticket</category> </item> </channel> </rss>