Multipartite/Shell layouts do not work if there are a varying number of nodes per layer/shell due to a np.ones_like call on the layers list in the get_multipartite_layout() function.
Getting the following error code:
File "/.venv/lib/site-packages/netgraph/_node_layout.py", line 1473, in get_shell_layout
multipartite_positions = get_multipartite_layout(
File "/.venv/lib/site-packages/netgraph/_node_layout.py", line 1367, in get_multipartite_layout
node_spacings = np.ones_like(layers, dtype=float)
File "<__array_function__ internals>", line 200, in ones_like
File "/.venv/lib/site-packages/numpy/core/numeric.py", line 281, in ones_like
res = empty_like(a, dtype=dtype, order=order, subok=subok, shape=shape)
File "<__array_function__ internals>", line 200, in empty_like
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
Code to reproduce error (taken from this repo's tests):
Can probably be fixed by changing the occurences np.ones_like(layers, dtype=float) to np.ones(shape=len(layers), dtype=float) in the get_multipartitide_layout() function
Multipartite/Shell layouts do not work if there are a varying number of nodes per layer/shell due to a
np.ones_like
call on the layers list in theget_multipartite_layout()
function.Getting the following error code:
Code to reproduce error (taken from this repo's tests):
Making the number of nodes on each layer works fine:
Can probably be fixed by changing the occurences
np.ones_like(layers, dtype=float)
tonp.ones(shape=len(layers), dtype=float)
in the get_multipartitide_layout() function