OLD | NEW |
| (Empty) |
1 :mod:`altgraph.GraphAlgo` --- Graph algorithms | |
2 ================================================== | |
3 | |
4 .. module:: altgraph.GraphAlgo | |
5 :synopsis: Basic graphs algoritms | |
6 | |
7 .. function:: dijkstra(graph, start[, end]) | |
8 | |
9 Dijkstra's algorithm for shortest paths. | |
10 | |
11 Find shortest paths from the start node to all nodes nearer | |
12 than or equal to the *end* node. The edge data is assumed to be the edge leng
th. | |
13 | |
14 .. note:: | |
15 | |
16 Dijkstra's algorithm is only guaranteed to work correctly when all edge l
engths are positive. | |
17 This code does not verify this property for all edges (only the edges exa
mined until the end | |
18 vertex is reached), but will correctly compute shortest paths even for so
me graphs with negative | |
19 edges, and will raise an exception if it discovers that a negative edge h
as caused it to make a mistake. | |
20 | |
21 | |
22 .. function:: shortest_path(graph, start, end) | |
23 | |
24 Find a single shortest path from the given start node to the given end node. | |
25 The input has the same conventions as :func:`dijkstra`. The output is a list | |
26 of the nodes in order along the shortest path. | |
OLD | NEW |