In [1]:
%matplotlib inline

In [2]:
import networkx as nx
import pandas as pd
import projx as px
import matplotlib.pyplot as plt

In [3]:
plt.rcParams['figure.figsize'] = (12, 7)

In [4]:
def prob_dist(itrbl):
    count = {}
    for i in itrbl:
        count.setdefault(i, 0)
        count[i] += 1
    sr = pd.Series(count)
    prob = sr.apply(lambda x: float(x) / len(itrbl))
    return prob

In [5]:
graph = nx.read_gexf("projections/ninetyfive_percent_cut.gexf")

In [6]:
subgraphs = list(nx.connected_component_subgraphs(graph))
print([len(sub) for sub in subgraphs])


[44, 4, 4, 2, 5]

In [7]:
g = subgraphs[0]
g1 = subgraphs[1]
g2 = subgraphs[2]
g3 = subgraphs[3]

In [ ]:
nx.write_gexf(g, "projections/ninety_percent_cut.gexf")

In [8]:
plt.rcParams['figure.figsize'] = (17, 12)

In [9]:
px.draw_simple_graph(g)



In [10]:
plt.rcParams['figure.figsize'] = (12, 7)

In [11]:
px.draw_simple_graph(g1)



In [12]:
px.draw_simple_graph(g2)



In [13]:
px.draw_simple_graph(g3)



In [13]: