Skip to content

Instantly share code, notes, and snippets.

@julian-west
Created September 7, 2019 16:59
Show Gist options
  • Save julian-west/2b3800b324eeeb2d339f097f6dd7f759 to your computer and use it in GitHub Desktop.
Save julian-west/2b3800b324eeeb2d339f097f6dd7f759 to your computer and use it in GitHub Desktop.
#create undirected graph with weights corresponding to the correlation magnitude
G0 = nx.from_pandas_edgelist(edges, 'asset_1', 'asset_2', edge_attr=['correlation'])
#print out the graph info
#check number of nodes and degrees are as expected (all should have degree = 38, i.e. average degree = 38)
print(nx.info(G0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment