If you create a networkx graph from an edge list where a component is disconnected, FINDER will fail and raise a std::bad_alloc.
This happened because the GenNetwork function created an array of length g.nodes(), but indexed it with the original names of the node.
Example:
>>> test = np.array([0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [1, 1, 1, 0]])
>>> g = nx.from_numpy_array(test)
>>> g.remove_node(2)
>>>
>>> # some more detail:
>>> a, b = zip(*g.edges())
>>> a
(0, 1)
>>> b # <<< Here is the error!
(3, 3)
>>> len(g.nodes())
3
The resulting graph can not be processed with finder.
This patch resolves this and makes handling of such graphs possible.
If you create a networkx graph from an edge list where a component is disconnected, FINDER will fail and raise a std::bad_alloc.
This happened because the GenNetwork function created an array of length g.nodes(), but indexed it with the original names of the node.
Example:
The resulting graph can not be processed with finder.
This patch resolves this and makes handling of such graphs possible.