Skip to content
GitLab
Menu
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
655107df
Commit
655107df
authored
Mar 25, 2013
by
Tiago Peixoto
Browse files
Raise exception in random_spanning_tree() if the graph is not connected
parent
6d3b293c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/topology/__init__.py
View file @
655107df
...
...
@@ -489,7 +489,9 @@ def random_spanning_tree(g, weights=None, root=None, tree_map=None):
# we need to restrict ourselves to the in-component of root
l
=
label_out_component
(
GraphView
(
g
,
reversed
=
True
),
root
)
g
=
GraphView
(
g
,
vfilt
=
l
)
u
=
GraphView
(
g
,
vfilt
=
l
)
if
u
.
num_vertices
()
!=
g
.
num_vertices
():
raise
ValueError
(
"There must be a path from all vertices to the root vertex: %d"
%
int
(
root
)
)
libgraph_tool_topology
.
\
random_spanning_tree
(
g
.
_Graph__graph
,
int
(
root
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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