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
a3eae6a3
Commit
a3eae6a3
authored
Apr 20, 2016
by
Tiago Peixoto
Browse files
tsp_tour(): raise exception for directed graphs
This closes issue #293
parent
91843211
Pipeline
#170
passed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/topology/__init__.py
View file @
a3eae6a3
...
...
@@ -2302,7 +2302,7 @@ def tsp_tour(g, src, weight=None):
Parameters
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
Graph to be used.
The graph must be undirected.
src : :class:`~graph_tool.Vertex`
The source (and target) of the tour.
weight : :class:`~graph_tool.PropertyMap` (optional, default: None)
...
...
@@ -2335,6 +2335,8 @@ def tsp_tour(g, src, weight=None):
"""
if
g
.
is_directed
():
raise
ValueError
(
"The graph must be undirected."
)
tour
=
libgraph_tool_topology
.
\
get_tsp
(
g
.
_Graph__graph
,
int
(
src
),
_prop
(
"e"
,
g
,
weight
))
return
tour
.
a
.
copy
()
...
...
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