Commit 73b62d72 authored by Tiago Peixoto's avatar Tiago Peixoto

LayeredBlockState: fix behavior for overlapping states with filtered graphs

This fixes issue #679
parent 32746cc8
......@@ -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
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment