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
fdc1c377
Commit
fdc1c377
authored
Jun 16, 2015
by
Tiago Peixoto
Browse files
PropertyMap: assure that filtered arrays (fa) have always the correct size
This closes issue
#228
parent
06157bcc
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/__init__.py
View file @
fdc1c377
...
...
@@ -552,8 +552,10 @@ class PropertyMap(object):
filt
=
[
None
]
if
self
.
__key_type
==
'v'
:
filt
=
g
.
get_vertex_filter
()
N
=
g
.
num_vertices
()
elif
self
.
__key_type
==
'e'
:
filt
=
g
.
get_edge_filter
()
N
=
g
.
_get_max_edge_index
()
if
g
.
get_vertex_filter
()[
0
]
is
not
None
:
filt
=
(
g
.
new_edge_property
(
"bool"
),
filt
[
1
])
u
=
GraphView
(
g
,
directed
=
True
,
skip_properties
=
True
)
...
...
@@ -569,7 +571,7 @@ class PropertyMap(object):
return
a
if
filt
[
0
]
is
None
:
return
a
return
a
[
filt
[
0
].
a
==
(
not
filt
[
1
])]
return
a
[
filt
[
0
].
a
==
(
not
filt
[
1
])]
[:
N
]
else
:
if
a
is
None
:
return
...
...
@@ -580,6 +582,7 @@ class PropertyMap(object):
a
[:]
=
v
[:
len
(
a
)]
else
:
m
=
filt
[
0
].
a
==
(
not
filt
[
1
])
m
*=
m
.
cumsum
()
<=
N
try
:
a
[
m
]
=
v
except
ValueError
:
...
...
src/graph_tool/draw/cairo_draw.py
View file @
fdc1c377
...
...
@@ -1137,7 +1137,7 @@ def scale_ink(scale, vprops, eprops):
def
get_bb
(
g
,
pos
,
size
,
pen_width
,
size_scale
=
1
,
text
=
None
,
font_family
=
None
,
font_size
=
None
,
cr
=
None
):
size
=
size
.
fa
[:
g
.
num_vertices
()]
if
isinstance
(
size
,
PropertyMap
)
else
size
size
=
size
.
fa
if
isinstance
(
size
,
PropertyMap
)
else
size
pen_width
=
pen_width
.
fa
if
isinstance
(
pen_width
,
PropertyMap
)
else
pen_width
pos_x
,
pos_y
=
ungroup_vector_property
(
pos
,
[
0
,
1
])
if
text
is
not
None
and
text
!=
""
:
...
...
Write
Preview
Supports
Markdown
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