G1 = nx.erdos_renyi_graph(5,0.4)
nx.draw_shell(G1)

print "Dist. media: ", nx.average_shortest_path_length(G1)
print "Diametro: ", nx.diameter(G1)
print "Coef. Agrupamento médio: ", nx.average_clustering(G1)

G2 = nx.barabasi_albert_graph(6,3)
nx.draw_shell(G2)

print "Dist. media: ", nx.average_shortest_path_length(G2)
print "Diametro: ", nx.diameter(G2)
print "Coef. Agrupamento médio: ", nx.average_clustering(G2)

G3 = nx.barabasi_albert_graph(6,4)
nx.draw_shell(G3)

print "Dist. media: ", nx.average_shortest_path_length(G3)
print "Diametro: ", nx.diameter(G3)
print "Coef. Agrupamento médio: ", nx.average_clustering(G3)

"""
Explanation: Exercício 01: Calcule a distância média, o diâmetro e o coeficiente de agrupamento das redes abaixo.
End of explanation
"""


G4 = nx.barabasi_albert_graph(6,3)
plt.pyplot.figure(figsize=(10,10))
pos = nx.shell_layout(G4)
nx.draw_networkx_nodes(G4,pos);
nx.draw_networkx_edges(G4,pos);
nx.draw_networkx_labels(G4,pos);
plt.pyplot.axis('off')

print "Centralidades de grau:"
for ni,dc in nx.degree_centrality(G4).items():
    print ni, dc

print "Centralidades de pagerank:"
for ni,dc in nx.pagerank(G4).items():
    print ni, dc

print "Centralidades de betweenness:"
for ni,dc in nx.betweenness_centrality(G4).items():
    print ni, dc

"""
Explanation: Exercício 02: Calcule a centralidade de grau, betweenness e pagerank dos nós das redes abaixo:
End of explanation
"""


