Exemple #1
0
def func():
    file_name = "data.txt"
    target_dict = get_target_provenance(file_name) ;
    tuplelist = get_tuplelist(file_name) ;

    mc_num = 1000 ;
    print "mc_num: %d", mc_num ;
 
    pool = Pool(1) ;
    tasks = [ [tuplelist, mydict, term, mc_num] for term in mydict ] ;
    #print tasks ;

    pool_outputs = pool.map(mc_graph, tasks)
    pool.close()
    pool.join()
    
    f = open("ps_pn_output.txt", "w") ; 
    print >> f, 'Pool:', pool_outputs;
    f.close() ;
Exemple #2
0
def func():
    file_name = "158-146/158-146-1035-traces.txt"
    [tuplelist, mydict] = get_tuplelist(file_name) ;
    print "edge num is: ", len(mydict) ;
    #nID = raw_input("Input your id plz") ;

    mc_num = 1000000 ;
    print "mc_num: %d", mc_num ;
    #print "edges: ", mydict ;
 
    pool = Pool(1) ;
    tasks = [ [tuplelist, mydict, term, mc_num] for term in mydict ] ;
    #print tasks ;

    pool_outputs = pool.map(mc_graph, tasks)
    pool.close()
    pool.join()
    
    f = open("ps_pn_output.txt", "w") ; 
    print >> f, 'Pool:', pool_outputs;
    f.close() ;
Exemple #3
0
        #print "add edge %s %s" % (start, node) ;
        walk(G, node) ; 
    

def run_once(G, start_node):
    global provenance_dict ;
    print "-------------start walk------------"
    for i in range(200):
        if(i%100 == 0): print "-----walk %d ----"%i
        initStep() ;
        path.append(start_node) ;
        walk(G, start_node) ;


print "------------reading graph-----------"
file_name = "/home/pear/one_multi_pro_ranking/dataset/karate.txt" ;
G = nx.read_edgelist(file_name) ;
start_node = "1"
end_list = ["29", "10", "4", "24", "27", "32", "2", "21", "16", "6"] ;
    
run_once(G, start_node) ;

write_file = "test-walk.txt" ;
f = open(write_file, 'w') ;
for key in provenance_dict:
    print >>f, key ;
f.close() ;

[nouse, mydict] = get_tuplelist(write_file) ;
print "edge num: ",len(mydict) ;
Exemple #4
0
from BasicFunction import getTargetListKarate, get_edge_list, get_tuplelist ;

targetlist = getTargetListKarate() ;

write_file = "data_file/why-1_checked_causality.txt" ;
[prolist, mydict] = get_tuplelist(write_file) ;

lenlist = [] ;
for pro in prolist:
    lenlist.append( len(pro) ) ;

print min(lenlist), max(lenlist) ;

print "edge num: ",len(mydict) ;
nodeset = set() ;
for key in mydict.keys():
    temp = key.split("-") ;
    nodeset.add(temp[0]) ;
    nodeset.add(temp[1]) ;
    print ",".join(temp) ;

print len(nodeset) ;
print set(targetlist) & nodeset ;