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): ...@@ -160,9 +160,10 @@ class LayeredBlockState(OverlapBlockState, BlockState):
if overlap and self.ec is not None: if overlap and self.ec is not None:
self.base_ec = self.base_g.own_property(ec.copy()) self.base_ec = self.base_g.own_property(ec.copy())
ec = agg_state.eindex.copy() ec = agg_state.g.new_ep("int")
pmap(ec, self.ec) eindex = self.base_g.edge_index.copy()
self.ec = ec.copy("int") ec.fa = self.ec.a[eindex.fa]
self.ec = ec
self.eweight = eweight self.eweight = eweight
self.vweight = vweight self.vweight = vweight
......
...@@ -87,8 +87,8 @@ def partition_entropy(B, N, nr=None): ...@@ -87,8 +87,8 @@ def partition_entropy(B, N, nr=None):
return S return S
def pmap(prop, value_map): def pmap(prop, value_map):
"""Maps all the values of `prop` to the values given by `value_map`, which """Maps all the values of `prop` to the values given by `value_map` in-place
is indexed by the values of `prop`.""" according to: ``prop[i] = value_map[prop[i]]``."""
if isinstance(prop, PropertyMap): if isinstance(prop, PropertyMap):
a = prop.fa a = prop.fa
else: else:
...@@ -96,7 +96,7 @@ def pmap(prop, value_map): ...@@ -96,7 +96,7 @@ def pmap(prop, value_map):
if isinstance(value_map, PropertyMap): if isinstance(value_map, PropertyMap):
value_map = value_map.fa value_map = value_map.fa
if a.max() >= len(value_map): 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(), " max val: %s, map size: %s" % (a.max(),
len(value_map))) len(value_map)))
if a.dtype != value_map.dtype: 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