parameters: (graphPaths, outPath, algorithms, arglist=None, repeat=1, graphFormat=Format.METIS)
docstring: Evaluate community detection algorithms on a collection of graphs and save benchmark data in .csv format
  		:param	graphPaths	paths to graph files
  		:param 	algorithms	list of algorithms
docstring_summary: Evaluate community detection algorithms on a collection of graphs and save benchmark data in .csv format
  		:param	graphPaths	paths to graph files
  		:param 	algorithms	list of algorithms
docstring_tokens: Evaluate community detection algorithms on a collection of graphs and save benchmark data in . csv format : param graphPaths paths to graph files : param algorithms list of algorithms
function: def communityDetectionBenchmark(graphPaths, outPath, algorithms, arglist=None, repeat=1, graphFormat=Format.METIS):
  	"""
  		Evaluate community detection algorithms on a collection of graphs and save benchmark data in .csv format
  		:param	graphPaths	paths to graph files
  		:param 	algorithms	list of algorithms
  	"""
  	if not arglist:
  		arglist = [{} for i in range(len(algorithms))]
  
  	# write results
  	with open(outPath, 'w') as outFile:
  		writer = csv.writer(outFile, delimiter='\t')
  		header = ["graph", "algo", "time", "modularity"]
  		writer.writerow(header)
  		for graphPath in graphPaths:
  			print("reading graph: {0}".format(graphPath))
  			G = graphio.readGraph(graphPath, fileformat=graphFormat)
  			graphName = os.path.basename(graphPath).split(".")[0]
  			(n, m) = properties.size(G)
  			for (algoClass, kwargs) in zip(algorithms, arglist):
  				for i in range(repeat):
  					algo = algoClass(G, **kwargs)
  					algoName = algo.toString()
  					print("evaluating {0} on {1}".format(algoName, graphName))
  					timer = stopwatch.Timer()
  					algo.run()
  					zeta = algo.getPartition()
  					timer.stop()
  					time = timer.elapsed
  
  					mod = community.Modularity().getQuality(zeta, G)
  					# nc = zeta.numberOfSubsets()
  
  					row = [graphName, algoName, time, mod]
  					writer.writerow(row)
  					print(row)
function_tokens: def communityDetectionBenchmark ( graphPaths , outPath , algorithms , arglist = None , repeat = 1 , graphFormat = Format . METIS ) : if not arglist : arglist = [ { } for i in range ( len ( algorithms ) ) ] # write results with open ( outPath , 'w' ) as outFile : writer = csv . writer ( outFile , delimiter = '\t' ) header = [ "graph" , "algo" , "time" , "modularity" ] writer . writerow ( header ) for graphPath in graphPaths : print ( "reading graph: {0}" . format ( graphPath ) ) G = graphio . readGraph ( graphPath , fileformat = graphFormat ) graphName = os . path . basename ( graphPath ) . split ( "." ) [ 0 ] ( n , m ) = properties . size ( G ) for ( algoClass , kwargs ) in zip ( algorithms , arglist ) : for i in range ( repeat ) : algo = algoClass ( G , * * kwargs ) algoName = algo . toString ( ) print ( "evaluating {0} on {1}" . format ( algoName , graphName ) ) timer = stopwatch . Timer ( ) algo . run ( ) zeta = algo . getPartition ( ) timer . stop ( ) time = timer . elapsed mod = community . Modularity ( ) . getQuality ( zeta , G ) # nc = zeta.numberOfSubsets() row = [ graphName , algoName , time , mod ] writer . writerow ( row ) print ( row )