예제 #1
0
def HIndexJudgement(graphFile, n):
    '''
	@author:
		[email protected]
	@params:
		graphFile: full name of input graph;
	@return:
		calcTime: time for calculation;
		result: n-order H Index values of graph, type: List;
	'''
    graphFileName, graphFileFormat = graphFile.split(".", 1)

    if graphFileFormat == 'edgelist':
        edgelist2gml.edgelist2gml(graphFile)
    elif graphFileFormat == 'net':
        net2gml.net2gml(graphFile)

    nxG = nx.read_gml(graphFileName + '.gml')
    igG = ig.Graph.Read_GML(graphFileName + '.gml')

    start_time = time.clock()
    # demo: result = calcH0IndexValues(nxG,igG)
    # your solution:
    result = calcHIndexValues(nxG, igG, n)
    end_time = time.clock()
    calcTime = end_time - start_time

    return (result, calcTime)
예제 #2
0
def getGraph(graphFile):
    graphFileName, graphFileFormat = graphFile.split(".", 1)

    if graphFileFormat == 'edgelist':
        edgelist2gml.edgelist2gml(graphFile)
    elif graphFileFormat == 'net':
        net2gml.net2gml(graphFile)

    nxG = nx.read_gml(graphFileName + '.gml', label='id')
    return nxG