sorry for my naive question. I'd like to import hundreds of large and dense
adjacency matrices available as a numpy arrays into graph_tool.
The following option takes very long. Q1: Is there a preferable alternative?
import graph_tool.all as gt
import numpy as np
g = gt.Graph(directed=False)
vlist = g.add_vertex(n_vertices)
edge_ids = np.where(adj !=0)
for i in range(edge_ids.shape):
Since I am dealing with undirected graphs without selfloops a first step
would be to take only one triangle of the symmetric adjacency matrix:
# get ids of upper triangle
upper_tr = np.triu_indices_from(np.zeros((n_vertices,n_vertices)))
adj[a,a] = 0
Q2: is this a valid approach?
Thanks in advance,