Commit ace2539f authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix docstring issues

parent da2167f0
......@@ -1005,23 +1005,23 @@ def edge_difference(g, prop, ediff=None):
>>> g = gt.random_graph(100, lambda: (3, 3))
>>> ediff = gt.edge_difference(g, g.vertex_index)
>>> print(ediff.a)
[ 63 74 70 -19 1 -41 -54 -38 -68 -87 -85 -40 -41 -6 -3 4 12 -40
-1 1 -47 -31 -49 -39 28 -37 -50 -32 -34 -12 -1 -4 5 10 8 -51
-27 18 -3 45 -13 42 3 -31 25 -21 44 -28 -34 53 -5 -7 47 -26
67 7 28 -24 30 50 24 39 43 45 64 78 74 84 -7 32 73 47
34 70 2 -2 -78 -92 81 22 80 37 66 -2 1 26 95 26 62 66
30 7 56 79 69 80 74 84 8 47 73 54 11 79 71 60 72 57
41 -15 33 -15 -28 -4 -29 -13 -8 -40 -6 6 -19 -22 15 10 -7 -13
-29 -10 32 -9 -30 -14 -63 -60 -2 -13 -39 10 12 14 -37 -29 -16 -65
1 -52 -21 -49 -43 -57 54 31 62 -40 -66 -53 -12 -71 -92 -18 -49 -65
-83 -80 -33 -67 -70 -58 -40 -53 -44 -71 -46 -75 -37 -44 -57 -3 -15 -76
4 16 -55 -10 1 -33 16 -6 -7 -66 -49 -57 -58 -35 -32 20 -28 -58
9 28 7 -67 29 6 -17 -54 -8 -31 24 -37 -29 -19 -5 -13 17 -39
-25 17 25 62 65 -17 34 -7 12 3 17 -13 -5 40 74 80 36 73
75 52 4 75 67 43 17 33 57 44 40 34 -26 -15 -5 31 30 51
-17 21 5 -19 34 -1 12 -1 62 -27 33 -22 43 -22 -39 33 -24 41
-37 17 -31 45 -40 -39 -36 49 16 36 -19 44 36 -51 -35 -13 4 14
-44 -16 -8 -13 9 -29 10 -62 -26 -47 -44 3]
[ 47 66 10 -1 -65 -56 -91 -62 -38 -1 -86 3 -46 -62 -23 -17 -75 -74
23 -22 9 2 -35 8 -24 -16 -59 -60 32 -13 -43 30 26 -33 32 -8
17 -29 -3 -38 -45 41 50 11 -37 58 13 -23 20 48 -17 64 38 22
63 32 17 7 -10 34 71 20 43 -3 22 13 70 15 63 16 64 86
37 43 32 -4 -34 -19 36 67 63 65 74 39 17 43 10 29 28 37
67 93 61 81 27 -2 20 68 50 45 30 71 -1 39 48 -11 25 50
-25 32 -2 22 -3 40 -29 -7 7 33 8 29 -40 47 -31 -6 -48 -1
-13 4 -27 -57 9 2 22 -35 23 -2 21 25 -67 -39 -14 -82 -42 -7
-74 -27 -43 -10 -22 -36 28 21 1 -15 -71 -63 -72 -14 -40 -78 -43 -23
-83 -12 -43 -26 -48 -52 -58 -82 -14 -44 -62 1 -31 -51 -84 -42 -37 -59
4 -21 -63 -60 -22 -77 -64 -11 4 18 -56 19 4 -12 3 23 -29 -14
-15 -38 -20 -34 -62 -49 -47 29 32 -1 -53 -21 19 13 15 -21 12 -30
-4 -33 66 39 -17 2 50 16 28 -59 -50 -58 69 53 68 -3 60 35
68 -13 -6 48 71 58 14 58 -4 51 52 13 32 -8 -2 63 56 19
47 -1 53 39 45 -18 -13 56 52 -16 44 49 -16 35 -11 49 14 -17
33 11 -8 -31 38 -46 48 -34 47 33 -45 -29 16 3 -48 -44 -58 -9
-12 -57 -21 -47 34 10 -23 -44 -37 -44 1 11]
"""
val_t = prop.value_type()
if val_t == "unsigned long":
......@@ -2440,12 +2440,12 @@ def _vertex_repr(self):
return "<Vertex object with index '%d' at 0x%x>" % (int(self), id(self))
Vertex.__repr__ = _vertex_repr
Vertex.__eq__ = lambda v1, v2 : int(v1) == int(v2)
Vertex.__ne__ = lambda v1, v2 : int(v1) != int(v2)
Vertex.__lt__ = lambda v1, v2 : int(v1) < int(v2)
Vertex.__gt__ = lambda v1, v2 : int(v1) > int(v2)
Vertex.__le__ = lambda v1, v2 : int(v1) <= int(v2)
Vertex.__ge__ = lambda v1, v2 : int(v1) >= int(v2)
Vertex.__eq__ = lambda v1, v2 : int(v1) == (int(v2) if isinstance(v2, Vertex) else v2)
Vertex.__ne__ = lambda v1, v2 : int(v1) != (int(v2) if isinstance(v2, Vertex) else v2)
Vertex.__lt__ = lambda v1, v2 : int(v1) < (int(v2) if isinstance(v2, Vertex) else v2)
Vertex.__gt__ = lambda v1, v2 : int(v1) > (int(v2) if isinstance(v2, Vertex) else v2)
Vertex.__le__ = lambda v1, v2 : int(v1) <= (int(v2) if isinstance(v2, Vertex) else v2)
Vertex.__ge__ = lambda v1, v2 : int(v1) >= (int(v2) if isinstance(v2, Vertex) else v2)
_edge_doc = """Edge descriptor.
......
......@@ -140,7 +140,7 @@ def edmonds_karp_max_flow(g, source, target, capacity, residual=None):
>>> res.a = cap.a - res.a # the actual flow
>>> max_flow = sum(res[e] for e in tgt.in_edges())
>>> print(max_flow)
45.59770256530269
44.89059578411614
>>> pos = g.vertex_properties["pos"]
>>> gt.graph_draw(g, pos=pos, edge_pen_width=gt.prop_to_size(res, mi=0, ma=5, power=1), output="example-edmonds-karp.pdf")
<...>
......@@ -221,7 +221,7 @@ def push_relabel_max_flow(g, source, target, capacity, residual=None):
>>> res.a = cap.a - res.a # the actual flow
>>> max_flow = sum(res[e] for e in tgt.in_edges())
>>> print(max_flow)
45.59770256530269
44.89059578411614
>>> pos = g.vertex_properties["pos"]
>>> gt.graph_draw(g, pos=pos, edge_pen_width=gt.prop_to_size(res, mi=0, ma=5, power=1), output="example-push-relabel.pdf")
<...>
......@@ -303,7 +303,7 @@ def boykov_kolmogorov_max_flow(g, source, target, capacity, residual=None):
>>> res.a = cap.a - res.a # the actual flow
>>> max_flow = sum(res[e] for e in tgt.in_edges())
>>> print(max_flow)
45.59770256530269
44.89059578411614
>>> pos = g.vertex_properties["pos"]
>>> gt.graph_draw(g, pos=pos, edge_pen_width=gt.prop_to_size(res, mi=0, ma=3, power=1), output="example-kolmogorov.pdf")
<...>
......
......@@ -744,7 +744,7 @@ def dijkstra_search(g, source, weight, visitor=DijkstraVisitor(), dist_map=None,
>>> time = g.new_vertex_property("int")
>>> dist, pred = gt.dijkstra_search(g, g.vertex(0), weight, VisitorExample(name, time))
--> Bob has been discovered!
--> Bob has been discovered!
edge (Bob, Eve) has been examined...
edge (Bob, Eve) has been relaxed...
--> Eve has been discovered!
......@@ -1381,7 +1381,7 @@ def astar_search(g, source, weight, visitor=AStarVisitor(),
>>> ewidth = g.new_edge_property("double")
>>> ewidth.a = 1
>>> for e in g.edges():
... ecolor[e] = "blue" if touch_e[e] else "black"
... ecolor[e] = "#3465a4" if touch_e[e] else "#d3d7cf"
>>> v = target
>>> while v != g.vertex(0):
... p = g.vertex(pred[v])
......
......@@ -673,8 +673,8 @@ def topological_sort(g):
>>> g.set_edge_filter(tree)
>>> sort = gt.topological_sort(g)
>>> print(sort)
[29, 28, 27, 26, 23, 24, 22, 21, 20, 18, 17, 16, 15, 14, 11, 10, 9,
6, 5, 4, 19, 12, 13, 3, 2, 25, 1, 0, 7, 8]
[29 28 27 26 23 24 22 21 20 18 17 16 15 14 11 10 9 6 5 4 19 12 13 3 2
25 1 0 7 8]
References
----------
......@@ -1565,7 +1565,7 @@ def is_planar(g, embedding=False, kuratowski=False):
>>> print(p)
True
>>> print(list(embed_order[g.vertex(0)]))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
[0, 1, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2]
>>> g = gt.random_graph(100, lambda: 4, directed=False)
>>> p, kur = gt.is_planar(g, kuratowski=True)
>>> print(p)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment