#8714: add Bellman-Ford algorithm for shortest paths
---------------------------------+----------------------------------
       Reporter:  mvngu          |        Owner:  jason, ncohen, rlm
           Type:  enhancement    |       Status:  needs_review
       Priority:  major          |    Milestone:  sage-5.13
      Component:  graph theory   |   Resolution:
       Keywords:                 |    Merged in:
        Authors:  David Coudert  |    Reviewers:
Report Upstream:  N/A            |  Work issues:
         Branch:  u/ncohen/8714  |       Commit:
   Dependencies:  #12806         |     Stopgaps:
---------------------------------+----------------------------------
Changes (by ncohen):

 * branch:   => u/ncohen/8714


Comment:

 Yoooooooooooo !

 I just reviewed this patch, and I don't see anything wrong. Several
 questions/remarks, though :
 - the `weights` dictionary is actually (in memory) a copy of the whole
 graph. Isn't it better to create a normalized copy of the graph and work
 on this only ?
 - Why `__bellman_ford__` and not just `_bellman_ford` ? Isn't the `__`
 only for special Python functions ?
 - You say that loops are supported, but I don't see how. Where do you
 detect if there is a negative loop somewhere, for instance ?
 - your function `ee` compares the vertices' name, and that's tricky.
 Sometimes the vertices of a graph are not integers, can be sets
 (KneserGraph for instance) and comparing them doesn't work as expected.

 Besides:
 - I modified a bit the behaviour of your modifications to
 `shortest_paths`, as this dictionary only needs to contain an entry for a
 target when such a path exists. I also used the fact that your Bellman
 Ford implementation satisfies `pred[t] = [t]` whenever `dist[t] ==
 Infinity`.
 - From the looks of `.all_pairs_shortest_path`, perhaps we should create a
 hidden function for the code of `Floyd-Warshall_Python`. Not urgent, just
 cleaning stuff.

 I added my patch as a git commit, to which the two previous hg patches
 belong. The new branch is u/ncohen/8714.

 Have fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuun ! `;-)`

 Nathann

--
Ticket URL: <http://trac.sagemath.org/ticket/8714#comment:18>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to