def __init__( self, inFileName, alpha=.85, selfLoops=False ): #, forwardApproach = True, multiplexed = True, mydtype = 'float32'): """ Args: inFileName : the name of the file describing the graph to be ranked using the page rank algorithm """ self.mydtype = 'float32' #mydtype self.multiplexed = True #multiplexed # the forward approach doesnt use a reverse graph. it pushes importance to each pi(i) as it iterates over the nodes following the adjList. self.forwardApproach = True #forwardApproach self.inFileName = inFileName #set alpha value self.alpha = alpha #whether using self loops or using alpha==0 for sinks self.selfLoops = selfLoops #make output file name self.outFileName = util.makeResOutFileName(self.inFileName, self.alpha, self.selfLoops) #this is only placed here to prevent errors when running empty template code self.rankVec = [] #dictionary of every node and its outlist and list of all node ids self.adjList, self.nodeIDs = util.loadGraphADJList(self.inFileName) #number of nodes total in map self.N = len(self.nodeIDs) #Task 1 : initialize data structures you will use self.initAllStructs()
def __init__(self, inFileName, alpha=.85, selfLoops=False): """ Args: inFileName : the name of the file describing the graph to be ranked using the page rank algorithm """ self.inFileName = inFileName # set alpha value self.alpha = alpha # whether using self loops or using alpha==0 for sinks self.selfLoops = selfLoops # make output file name self.outFileName = util.makeResOutFileName(self.inFileName, self.alpha, self.selfLoops) # this is only placed here to prevent errors when running empty templat # code self.rankVec = [] # dictionary of every node and its outlist and list of all node ids self.adjList, self.nodeIDs = util.loadGraphADJList(self.inFileName) # number of nodes total in map self.N = len(self.nodeIDs) # Task 1 : initialize data structures you will use self.initAllStructs()