#!/usr/bin/env python # coding: utf-8 # ### Overview # Analyze the interdependcies between classes as output from Roaster data. # # This notebook is authored by Paul Bastide. # No warranty. Provided as-is. # # ### Documentation # https://networkx.github.io/documentation/networkx-1.9/reference/generated/networkx.drawing.layout.spring_layout.html # https://networkx.github.io/documentation/latest/auto_examples/drawing/plot_unix_email.html # In[1]: get_ipython().system('pip install plotly networkx') # In[2]: import pandas as pd import matplotlib.pyplot as plt import plotly.graph_objects as go import networkx as nx # In[3]: df = pd.read_csv('diagram.csv', header = None) # In[4]: df.head() # In[5]: G = nx.MultiDiGraph() # In[6]: for input0, output0, in zip(df[0],df[1]): output0 = "" + str(output0) if output0: outputs = output0.split(',') for output in outputs: G.add_edge(input0,output, message=input0) # In[8]: plt.figure(3,figsize=(10,10)) pos = nx.spring_layout(G, iterations=50) nx.draw(G, pos, node_size=0, alpha=0.4, edge_color='b', font_size=10, with_labels=True) plt.draw() plt.savefig("diagram-network.png")