Created
July 27, 2010 12:53
-
-
Save Morail/492181 to your computer and use it in GitHub Desktop.
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
#!/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() | |
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