import networkx as nx
g = nx.read_edgelist("/Users/cazabetremy/Documents/GitHub/dynetx/dynetx/test/GOT/GoT_S01E01_000.edges")
print(list(g.nodes()))
print("degree of Jon: ",g.degree("Jon_Snow"))
print("neighb of Jon: ",g["Jon_Snow"])
print("density: ",nx.density(g))
from networkx.algorithms.approximation import average_clustering
print("avg_clustering: ",average_clustering(g))
from networkx.algorithms import community
connectedComp = list(nx.connected_components(g))
comsKcliques = list(community.k_clique_communities(g,k=3))
comsLabelPropa = list(community.asyn_lpa_communities(g))
print(len(connectedComp))
print(len(comsKcliques))
print(len(comsLabelPropa))
for c in comsKcliques:
print(c)
print("---")
for c in list(comsLabelPropa):
print(c)
print("---")
print("modularity CC",community.modularity(g,connectedComp))
print("modularity LP",community.modularity(g,comsLabelPropa))