Skip to content

Instantly share code, notes, and snippets.

@Morail
Created July 27, 2010 12:53
Show Gist options
  • Save Morail/492181 to your computer and use it in GitHub Desktop.
Save Morail/492181 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#coding=utf-8
import igraph as ig
def main():
from optparse import OptionParser
op = OptionParser(usage="usage: %prog file1 [file2 ...]")
op.add_option('-c', '--clean', action="store_true", dest="clean", help="Clean output")
opts, args = op.parse_args()
if not args:
op.error("Need a file to run analysis")
····
for arg in args:
try:
g = ig.load(arg)
if opts.clean:
print arg.split('/')[-1], len(g.vs), len(g.es)
else:
print arg.split('/')[-1]
print g.summary()
print
except ig.InternalError, e:
print e, "Cannot load %s" % (arg,)
if __name__ == "__main__":
d = main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment