Skip to content

Commit

Permalink
fix np array np.int64 conversion for python3
Browse files Browse the repository at this point in the history
  • Loading branch information
wweir827 committed Jun 15, 2018
1 parent fb7b9db commit 9762b75
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/VertexPartition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 9762b75

Please sign in to comment.