I am attempting to visualize a network on Dash using an adjacency matrix of size ~500x500 implemented with Cytoscape. I am converting the matrix into the proprietary input list style that the library uses. My code for doing so on a dictionary of dictionaries representation of an adjacency matrix is as follows:
def makeElementsList(inlist = networkvis.makeNetworkList()):
elsList = []
for i in inlist:
elsList.append({'data' : {'id' : str(i), 'label' : str(i)}})
for i, j in list(networkvis.makeAdjMatrix(inlist).items()):
for k, l in list(j.items()):
if l != 0:
elsList.append({'data' : {'source' : str(i), 'target' : str(k)}})
return elsList
app = dash.Dash(__name__)
# instantiate Dash object
app.layout = html.Div([
cyto.Cytoscape(
id='cytoscape_tweet_network',
layout={'name': 'circle'},
style={'width': '100%', 'height': '1000px'},
# elements=networkvis.makeNetworkList()[:10]
elements= makeElementsList()
)
])
I am able to get my webpage up and running when I bring down the size of my matrix to 10x10, but when I bring the size back up, the page takes ages to load, and ends up looking like a huge blob of nothing. It is not interactive at all either. Not sure if this is a problem with some of the parameters I'm choosing, or if the dataset is just too big for the library to handle, but I'd be really surprised if Cytoscape couldn't handle 500 nodes. It's worth adding that one of my initial responses to the problem was to try and host the page on a server much more capable than my machine. Nothing came of that, so I am thinking that this isn't a bandwidth issue.
question from:
https://stackoverflow.com/questions/65910477/dash-cytoscape-struggles-with-large-ish-datasets 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…