Created
January 31, 2017 13:28
-
-
Save lucas2213690/f3025287ee9e1021b2ec3a8578876c6c to your computer and use it in GitHub Desktop.
Python igraph example with Random graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from igraph import * | |
g = Graph.Erdos_Renyi(1000,0.0008,directed=False, loops=False) | |
array = g.degree(vertices=None, mode=ALL, loops=True) | |
print 'Numeros de vertices isolados (Grau 0) = %d '% array.count(0) | |
print 'Numeros de vertices com grau 1 = %d' % array.count(1) | |
print 'Numeros de vertices com grau 2 = %d' % array.count(2) | |
print 'Maior grau = %d ' % g.maxdegree(vertices=None, mode=ALL, loops=False) | |
components = g.components() | |
print 'O numero de componentes = %d' % len(components) | |
print 'Tamanho da maior componente = %d' % max(components.sizes()) | |
print 'Tamanho da menor component = %d' % min(components.sizes()) | |
g.write_svg('teste.svg', width=1000, height=1000, vertex_size=5, font_size=10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment