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
0
Merge Requests
0
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
4843cf1a
Commit
4843cf1a
authored
Apr 01, 2016
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make PropertyMap objects iterable
This fixes issue
#286
parent
9fcc539d
Pipeline
#125
passed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
src/graph_tool/__init__.py
src/graph_tool/__init__.py
+10
-5
No files found.
src/graph_tool/__init__.py
View file @
4843cf1a
...
...
@@ -561,6 +561,16 @@ class PropertyMap(object):
"'(%s, %s)', wanted types: (%s, %s)"
%
(
str
(
k
),
str
(
v
),
str
(
type
(
k
)),
str
(
type
(
v
)),
kt
,
vt
))
def
__iter__
(
self
):
g
=
self
.
__g
()
if
self
.
key_type
()
==
"g"
:
iters
=
[
g
]
elif
self
.
key_type
()
==
"v"
:
iters
=
g
.
vertices
()
else
:
iters
=
g
.
edges
()
for
x
in
iters
:
yield
self
[
x
]
def
__repr__
(
self
):
# provide some more useful information
...
...
@@ -898,11 +908,6 @@ class PropertyMap(object):
self
.
__map
.
resize
(
size
)
self
.
__map
.
shrink_to_fit
()
def
__call__
(
self
,
a
):
p
=
self
.
copy
()
p
.
fa
=
a
return
p
def
__getstate__
(
self
):
g
=
self
.
get_graph
()
if
g
is
None
:
...
...
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