Example #1
0
def interval_test(DAG, new, old):
    # new and old are the names of the 2 papers which form the interval
    # Find Interval
    interval_DAG = interval(DAG, new, old)
    interval_list = interval_DAG.nodes()
    inerval_size = len(interval_list)
    if interval_size < 1:
        print 'Interval is empty'
    print 'Interval size is %s' % str(interval_size)
        
    # Find LP
    lp = LP(interval_DAG, new, old)
    lp_len = len(lp)
    print 'Longest Path is %s' % str(lp_len)
    
    # Find DT
    dt = DT(interval_DAG, new, old)
    print 'Delta T is %s' % str(dt)
    
    # Find DR
    dr = DR(interval_DAG, new, old)
    print 'Delta Rank is %s' % str(dr)
    
    # Find MPSD
    mpsd = MPSD(interval_DAG, lp)
    print 'Midpoint Scaling Dimension is %s' % str(mpsd)
    
    # Find MMD
    mmd = MMD(interval_DAG)
    print 'Myrnheim Meyer Dimension is %s' % str(mmd)
Example #2
0
def interval_test(DAG,start,end):
    
    lp = dl.lpd(DAG,start,end)
    length = lp[2]
    print 'The longest path between %s and %s is %d edges long' %(start,end,length)
    
    interval = lc.interval(DAG,start,end)
    N = interval.number_of_nodes()
    E = interval.number_of_edges()
    print 'The interval contains %d nodes and %d edges' %(N,E)
    
    c = clus.clustering(interval)
    print 'For the interval, c+ is %f, c0 is %f, c- is %f' %(c[0],c[1],c[2])
    
    #MMd = MM.MM_dimension(interval)
    MPSD = mp.mpsd(interval,lp[1])
    #print 'The MM dimension of the interval is %f and the MPSD is %f' %(MMd,MPSD)
    print 'The MPSD is %f' %MPSD[0]
Example #3
0
 out = open('./Cit-HepPh_dimensiontest.txt','w')
 while sample > 0:
     node1 = choice(node_list)
     node2 = choice(node_list)
     bday1 = DAG.node[node1]['birthday']
     bday2 = DAG.node[node2]['birthday']
     if bday1 > bday2:
         start = node1
         end = node2
     else:
         start = node2
         end = node1
     if nx.has_path(DAG,start,end):
         if (DAG.node[start]['rank']-DAG.node[end]['rank']) < 3000:
             try:
                 intvl = lc.interval(DAG,start,end)
                 sample -= 1 #reduce sample number by 1 as we have found an eligable candidate pair
                 
                 N = len(intvl)
                 E = intvl.number_of_edges()
                 dbday = abs(bday1 - bday2)
                 rankS = DAG.node[start]['rank']
                 rankE = DAG.node[end]['rank']
                 lp_result = dl.lpd(DAG,start,end)
                 lp = lp_result[2]
                 path = lp_result[1]
                 print 'Finding MM'
                 MM_result = MM.MM_dimension(intvl,node_list)
                 intvl.clear() #for memory purposes
                 MMd = MM_result[0]
                 E_TC = MM_result[1]