After a helpful answer to my original question, I decided to use internal data (which I can't share here). The internal data follows the same format as the mock data. I simply copied the data over to the same working directory, making sure that the new data has the same format, i.e. same column headers, etc. I used DiffChecker to make sure that app.py
(from my original post) matches the Proof of Concept (appPOC.py
). The internal data has more than 600 nodes, and more than 3000 edges.
The code to make the interactive dashboard is the same as the one I used for my original post. However, this time I run into this KeyError
:
Traceback (most recent call last):
File "appPOC.py", line 75, in <module>
hovertext = "Document Description: " + str(G.nodes[node]['Description']) + "<br>" + "Document Name: " + str(G.nodes[node]['DocName']) + "<br>" + "Document ID: " + str(G.nodes[node]['DocumentID'])
KeyError: 'Description'
The data itself should be fine, as I can plot a network without the hovering text next to the node.
To summarize: app.py
can plot the mock data, appPOC.py
(which is identical, but has a different file name) can't plot the internal data. This leads me to believe that there is something wrong with the internal data in the CSV
file.
Edit: I figured out that if the target is not listed in the elements, the graph fails to be drawn. Is there anyway to create a node automatically (like in Gephi) if the (target) node is not defined in the elements?