# Ticket #10905: trac_10905-doctests.patch

File trac_10905-doctests.patch, 2.4 KB (added by Nathann Cohen, 12 years ago)
• ## sage/graphs/base/c_graph.pyx

```# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1300023383 -28800
# Node ID 1b52b9e7ee13a28f36cb2282d28b85b165f6a1e2
# Parent  17a58011e11c6bb2fe64f3e03bbf0626ff684140
trac 10905 -- shortest path all pairs through BFS computations. (fixing doctests)

diff -r 17a58011e11c -r 1b52b9e7ee13 sage/graphs/base/c_graph.pyx```
 a sage: dist, path = all_pairs_shortest_path_BFS(g) sage: all( dist[u][v] == g.distance(u,v) for u in g for v in g ) True TESTS: Too large graphs:: sage: all_pairs_shortest_path_BFS(Graph(65536)) Traceback (most recent call last): ... ValueError: The graph backend contains more than 65535 nodes """ from sage.rings.infinity import Infinity cdef int n = max(vertices)+1 if n > -1: raise ValueError("The graph backend contains more than "+( -1)+" nodes") raise ValueError("The graph backend contains more than "+str( -1)+" nodes") # The vertices which have already been visited cdef bitset_t seen
• ## sage/graphs/generic_graph.py

`diff -r 17a58011e11c -r 1b52b9e7ee13 sage/graphs/generic_graph.py`
 a ...     p.insert(0,path[u][p[0]]) sage: len(p) == dist[u][v] + 2 True TESTS: Wrong name for ``algorithm``:: sage: g.shortest_path_all_pairs(algorithm="Bob") Traceback (most recent call last): ... ValueError: The algorithm keyword can only be set to "auto", "BFS", "Floyd-Warshall-Python" or "Floyd-Warshall-Cython" """ if default_weight != 1: by_weight = True raise ValueError("The algorithm keyword can only be set to "+ "\"auto\","+ " \"BFS\", "+ "\"Floyd-Warshall-Cython\" or "+ "\"Floyd-Warshall-Python\" or "+ "\"Floyd-Warshall-Cython\"") from sage.rings.infinity import Infinity