Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
ace2539f
Commit
ace2539f
authored
Jan 08, 2015
by
Tiago Peixoto
Browse files
Fix docstring issues
parent
da2167f0
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/__init__.py
View file @
ace2539f
...
...
@@ -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 -
4
1 -
54 -38 -68 -87 -85 -40
-
4
1
-6
-
3
4 12 -40
-1 1 -47 -31 -49
-3
9
2
8 -
37 -50 -32 -34 -12
-1
-4
5 10 8 -51
-27 18 -3 45 -13 42 3
-3
1
25 -21 44 -28 -34 53 -5
-7
47 -26
6
7
7 28 -24
3
0
50
2
4
3
9
4
3
45 64 78
7
4
84 -7 32 73 47
3
4
70
2 -
2
-
78 -92 81 22 80 37
6
6
-2
1
26 95
2
6
62 66
30 7 56 79
6
9
8
0
74 84
8
47 73 54
1
1
7
9
71 60 72
5
7
41 -15 33 -15 -28 -4 -29 -13 -8 -40 -6 6 -19 -22 15 10 -7
-1
3
-
29 -10 32 -9 -30 -14 -63 -60
-
2
-13
-3
9
10
1
2
14
-
3
7 -
2
9 -1
6
-
65
1 -52
-2
1
-4
9
-
43 -57 54
3
1
62 -40 -66
-
5
3 -
1
2 -
71 -92
-
1
8 -4
9
-
65
-83 -
80
-
3
3 -
67 -70 -58 -40 -53 -44 -71 -46 -75 -37
-4
4
-
57 -3 -15 -76
4
16 -55
-
1
0
1 -33
1
6
-6
-7 -66 -49 -57 -58 -35 -32
2
0
-2
8
-
58
9 28 7
-
6
7 29
6
-1
7
-5
4 -8 -31 24 -37 -29 -19 -
5 -1
3
1
7
-3
9
-25 17 25
6
2
65
-17
34 -7 1
2
3
1
7 -13
-5
40 74 80 36 73
75 52
4 7
5
67 43 17 33
5
7
44 40 34 -26 -15
-
5
31 30 51
-1
7
2
1
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
4
4
3
6
-
51 -35 -13 4 14
-
44 -16 -8 -13 9 -29 10 -62 -26
-
4
7 -44
3
]
[
47 66
1
0
-1 -
65 -56 -91 -62 -38
-1 -
8
6
3
-46 -62 -23 -17 -75 -74
23 -22 9 2
-3
5
8 -
24 -16 -59 -60 32
-1
3
-4
3
30 26 -33 32 -8
17 -29 -3 -38 -45 41 50 11
-3
7
58 13 -23 20 48
-
1
7
64 38 22
6
3
32 17 7 -10
3
4
71
2
0
4
3
-
3
22 13
7
0
15 63 16 64 86
3
7
43
3
2 -
4
-
34 -19 36 67 63
6
5
74 39
1
7
43 10
2
9
28 37
67 93
6
1
8
1
27 -2 20
6
8
50 45 30 71
-
1
3
9
48 -11 25
5
0
-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
-3
5
23
-
2
21 25
-
6
7 -
3
9 -1
4
-
82 -42 -7
-74
-2
7
-4
3
-
10 -22 -36 28
2
1
1 -15 -71
-
6
3 -
7
2 -
14 -40
-
7
8 -4
3
-
23
-83 -
12
-
4
3 -
26 -48 -52 -58 -82 -14 -44 -62 1 -31 -51 -84
-4
2
-
37 -59
4
-21 -63
-
6
0
-22 -77 -64 -11 4
1
8
-
5
6
19 4 -12 3
2
3
-2
9
-
14
-15 -38 -20 -34 -62 -49
-
4
7 29
32
-1 -5
3 -21 19 13 1
5 -
2
1 1
2
-3
0
-4 -33
6
6
39
-17
2
50
1
6 28 -59 -50
-5
8
69 53 68 -3 60 35
68 -13 -6
4
8
7
1
58 14 58 -4
5
1
52 13 32 -8
-
2
63 56 19
4
7
-
1
53 39 45 -18
-1
3
56 52 -16 44 49 -16 35 -11 49 14 -17
33 11 -8 -31 38 -46 48 -34
4
7
3
3
-
45 -29 16 3 -48 -44 -58 -9
-
12 -57 -21 -47 34 10 -23 -44
-
3
7 -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.
...
...
src/graph_tool/flow/__init__.py
View file @
ace2539f
...
...
@@ -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)
4
5.59770256530269
4
4.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)
4
5.59770256530269
4
4.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)
4
5.59770256530269
4
4.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")
<...>
...
...
src/graph_tool/search/__init__.py
View file @
ace2539f
...
...
@@ -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])
...
...
src/graph_tool/topology/__init__.py
View file @
ace2539f
...
...
@@ -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
, 1
0
, 1
1
, 1
2
, 13, 1
4
, 1
5
, 1
6
,
17
,
1
8,
19, 20, 21, 22
,
2
3, 2
4
]
[0, 1, 2
4
,
2
3,
22, 21, 20, 19
,
1
8,
17
, 1
6
, 1
5
, 1
4
, 13, 1
2
, 1
1
, 1
0
,
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)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment