Modify

Ticket #7398 (closed Bugs: fixed)

Opened 19 months ago

Last modified 19 months ago

edge weights equal to distance_inf not correctly supported in dijkstra

Reported by: Alex Hagen-Zanker <ahh34@…> Owned by: jewillco
Milestone: To Be Determined Component: graph
Version: Boost 1.52.0 Severity: Problem
Keywords: dijkstra, relax Cc:

Description

The way that the relax() function works in relax.hpp is such that an edge_weight of distance_inf will not be consider for a shortest path.

The can lead to the false conclusion that vertices connected only through infinite cost edge are not connected at all.

This bug is related to #7387 and #7226. The patch of #7387 also solves this problem.

I am attaching an example with failing assertion.

Attachments

main.cpp Download (1.3 KB) - added by Alex Hagen-Zanker <ahh34@…> 19 months ago.
example of failing assert

Change History

Changed 19 months ago by Alex Hagen-Zanker <ahh34@…>

example of failing assert

comment:1 Changed 19 months ago by Alex Hagen-Zanker <ahh34@…>

  • Summary changed from edge weights equal to distance_inf lead not correctly supported in dijkstra to edge weights equal to distance_inf not correctly supported in dijkstra

comment:2 Changed 19 months ago by jewillco

  • Status changed from new to closed
  • Resolution set to invalid

This is the intended behavior -- the graph logically is assumed to have all edges, with some of those (the ones that are not connected in the graph's topology) having infinite weight. See  http://cpsc.ualr.edu/srini/DM/chapters/review5.3.html for an example; it is commonly used for shortest path algorithms. Thus, infinite-weight edges are treated as not existing at all since they are the same in the matrix representation. If you want an edge to be treated as active, give it a weight less than infinity. A scheme such as the one described at  http://tex.stackexchange.com/questions/21022/what-is-the-difference-between-fil-and-fill will give you multiple levels of "infinity" to use for edge weights and path lengths.

comment:3 Changed 19 months ago by Alex Hagen-Zanker <ahh34@…>

Ok.It does not seem like a very robust way of ignoring edges. It feels wrong to me to not filter out non-edges at the outer-loop of the algorithm but to do at the most detailed levels of computation. Even having to redefine the plus operations. Do you not use filtered_graph for that? How about measures like in-degree and out-degree, won't you get the wrong numbers? How about the visitors that are called along the way won't they get issued with mis-information? For instance vertices may now be discovered even when they are not reachable. The documentation says that "each reachable vertex is discovered exactly once". But it does not tell us that unreachable vertices may also be discovered.

http://www.boost.org/doc/libs/1_51_0/libs/graph/doc/dijkstra_shortest_paths.html

Anyway the use of edge weights invalidates quite a bit of my comments in #7387, but I suppose you figured that already.

Sorry to ramble, it just seems very wrong to me.

comment:4 Changed 19 months ago by Alex Hagen-Zanker <ahh34@…>

The following is also not correct:

"... only those vertices in V - S that are discovered and therefore have a distance less than infinity..."

comment:5 Changed 19 months ago by jewillco

  • Resolution changed from invalid to fixed

(In [80637]) Added wording that infinite-weight edges are not guaranteed to work correctly; fixes #7398

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.