Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tiago Peixoto
graph-tool
Commits
73b62d72
Commit
73b62d72
authored
Sep 15, 2020
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LayeredBlockState: fix behavior for overlapping states with filtered graphs
This fixes issue
#679
parent
32746cc8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
src/graph_tool/inference/layered_blockmodel.py
src/graph_tool/inference/layered_blockmodel.py
+4
-3
src/graph_tool/inference/util.py
src/graph_tool/inference/util.py
+3
-3
No files found.
src/graph_tool/inference/layered_blockmodel.py
View file @
73b62d72
...
...
@@ -160,9 +160,10 @@ class LayeredBlockState(OverlapBlockState, BlockState):
if
overlap
and
self
.
ec
is
not
None
:
self
.
base_ec
=
self
.
base_g
.
own_property
(
ec
.
copy
())
ec
=
agg_state
.
eindex
.
copy
()
pmap
(
ec
,
self
.
ec
)
self
.
ec
=
ec
.
copy
(
"int"
)
ec
=
agg_state
.
g
.
new_ep
(
"int"
)
eindex
=
self
.
base_g
.
edge_index
.
copy
()
ec
.
fa
=
self
.
ec
.
a
[
eindex
.
fa
]
self
.
ec
=
ec
self
.
eweight
=
eweight
self
.
vweight
=
vweight
...
...
src/graph_tool/inference/util.py
View file @
73b62d72
...
...
@@ -87,8 +87,8 @@ def partition_entropy(B, N, nr=None):
return
S
def
pmap
(
prop
,
value_map
):
"""Maps all the values of `prop` to the values given by `value_map`
, which
is indexed by the values of `prop
`."""
"""Maps all the values of `prop` to the values given by `value_map`
in-place
according to: ``prop[i] = value_map[prop[i]]`
`."""
if
isinstance
(
prop
,
PropertyMap
):
a
=
prop
.
fa
else
:
...
...
@@ -96,7 +96,7 @@ def pmap(prop, value_map):
if
isinstance
(
value_map
,
PropertyMap
):
value_map
=
value_map
.
fa
if
a
.
max
()
>=
len
(
value_map
):
raise
ValueError
(
"value
map is not large enough!"
+
raise
ValueError
(
"value
_
map is not large enough!"
+
" max val: %s, map size: %s"
%
(
a
.
max
(),
len
(
value_map
)))
if
a
.
dtype
!=
value_map
.
dtype
:
...
...
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