Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
43
Issues
43
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
9d542a89
Commit
9d542a89
authored
Jun 11, 2009
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make tgt parameter of Graph.copy_property() optional
parent
c2d45e12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
src/graph_tool/core.py
src/graph_tool/core.py
+13
-5
No files found.
src/graph_tool/core.py
View file @
9d542a89
...
...
@@ -562,12 +562,19 @@ class Graph(object):
# property map copying
@
_handle_exceptions
@
_require
(
"src"
,
PropertyMap
)
@
_require
(
"tgt"
,
PropertyMap
)
def
copy_property
(
self
,
src
,
tgt
,
g
=
None
):
"""Copy contents of `src` property to `tgt` property. The optional
parameter g specifices the (identical) source graph to copy properties
from (defaults to self).
@
_require
(
"tgt"
,
(
PropertyMap
,
type
(
None
)))
def
copy_property
(
self
,
src
,
tgt
=
None
,
g
=
None
):
"""Copy contents of `src` property to `tgt` property. If `tgt` is None,
then a new property map of the same type is created, and returned. The
optional parameter g specifices the (identical) source graph to copy
properties from (defaults to self).
"""
if
tgt
==
None
:
tgt
=
self
.
new_property
(
src
.
key_type
(),
src
.
value_type
())
ret
=
tgt
else
:
ret
=
None
if
src
.
key_type
()
!=
tgt
.
key_type
():
raise
GraphError
(
"source and target properties must have the same"
+
" key type"
)
...
...
@@ -587,6 +594,7 @@ class Graph(object):
self
.
pop_filter
()
if
g
!=
self
:
g
.
pop_filter
()
return
ret
# degree property map
@
_handle_exceptions
...
...
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