Error with get_edges_prob() for LayeredBlockState
I am playing with edge prediction in particular with LayeredBlockState class. However, a simple example raises a TypeError. Here I'm using the same dataset indicated in the documentation
import graph_tool.all as gt
g = gt.collection.ns["new_guinea_tribes"]
state = gt.minimize_nested_blockmodel_dl(g,
state_args=dict(base_type=gt.LayeredBlockState,
state_args=dict(ec=g.ep.weight, layers=True)))
missing = [(0, 6, 1), (0, 6, -1)]
state.get_edges_prob(missing)
which raises this error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-7a8e892c69fa> in <module>
6
7 missing = [(0, 6, 1), (0, 6, -1)]
----> 8 state.get_edges_prob(missing)
~/anaconda3/envs/experimental/lib/python3.8/site-packages/graph_tool/inference/nested_blockmodel.py in get_edges_prob(self, missing, spurious, entropy_args)
441 lstate._state.clear_egroups()
442
--> 443 L += lstate.get_edges_prob(missing, spurious, entropy_args=eargs)
444 if isinstance(self.levels[0], LayeredBlockState):
445 missing = [(lstate.b[u], lstate.b[v], l_) for u, v, l_ in missing]
~/anaconda3/envs/experimental/lib/python3.8/site-packages/graph_tool/inference/layered_blockmodel.py in get_edges_prob(self, missing, spurious, entropy_args)
788
789 nes.append((u, v, (l, False)))
--> 790 nes.append((self._get_lvertex(u, l),
791 self._get_lvertex(v, l), (l, True)))
792
~/anaconda3/envs/experimental/lib/python3.8/site-packages/graph_tool/inference/layered_blockmodel.py in _get_lvertex(self, v, l)
748 def _get_lvertex(self, v, l):
749 i = numpy.searchsorted(self.vc[v].a, l)
--> 750 if i >= len(self.vc[v]) or l != self.vc[v][i]:
751 raise ValueError("vertex %d not present in layer %d" % (v, l))
752 u = self.vmap[v][i]
TypeError: Invalid index type
I'm using graph_tool version 2.43