Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fa2/forceatlas2.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def forceatlas2_networkx_layout(self, G, pos=None, iterations=100, weight_attr=N
or (cynetworkx and isinstance(G, cynetworkx.classes.graph.Graph))
), "Not a networkx graph"
assert isinstance(pos, dict) or (pos is None), "pos must be specified as a dictionary, as in networkx"
M = networkx.to_scipy_sparse_matrix(G, dtype='f', format='lil', weight=weight_attr)
M = networkx.to_scipy_sparse_array(G, dtype='f', format='lil', weight=weight_attr)
if pos is None:
l = self.forceatlas2(M, pos=None, iterations=iterations)
else:
Expand All @@ -258,8 +258,8 @@ def forceatlas2_networkx_layout(self, G, pos=None, iterations=100, weight_attr=N
# This function returns an igraph layout
def forceatlas2_igraph_layout(self, G, pos=None, iterations=100, weight_attr=None):

from scipy.sparse import csr_matrix
import igraph
from scipy.sparse import csr_matrix

def to_sparse(graph, weight_attr=None):
edges = graph.get_edgelist()
Expand Down