diff --git a/src/VertexPartition.py b/src/VertexPartition.py index 6a0249f..3e72b92 100644 --- a/src/VertexPartition.py +++ b/src/VertexPartition.py @@ -2,6 +2,7 @@ from . import _c_louvain from .functions import _get_py_capsule import sys +import numpy as np # Check if working with Python 3 PY3 = (sys.version > '3') @@ -849,8 +850,15 @@ def __init__(self, graph, layer_vec=None, initial_membership=None, weights=None, else: # Make sure it is a list weights = list(weights) + + if layer_vec is not None: - layer_vec = list(layer_vec) # ensure that it is a list + layer_vec=np.array(layer_vec).tolist() + # if isinstance(layer_vec, np.ndarray): + # layer_vec = layer_vec.tolist() + # elif layer_vec is not None: + # layer_vec = list(layer_vec) + else: layer_vec = [0 for _ in range(graph.vcount())] #default is to assume single layer