示例#1
0
def cal_inner_degree(myTarget):
    allpaths = list(myTarget.tracelist) ;

    for path in allpaths:
        for key in allpaths:
            flag = True ;
            if( path != key ):
                pathset = set( get_edge_list(path) ) ;
                keyset =  set( get_edge_list(key) ) ;
                if( pathset.issubset(keyset) ):
                    #print "-----redundant trace-------"
                    myTarget.upsetdict[key] = 1 ;
示例#2
0
def get_redundant_degree(mytrace, otherTargets):
    degree = 0 ;
    for target in otherTargets:
        flag = 0 ;
        for temp in target.prolist:
            mytraceset = set( get_edge_list(mytrace) ) ;
            tempset = set( get_edge_list(temp) ) ;
            if( mytraceset.isuperset(tempset) ):
                flag = 1 ;
                break ;
        degree = degree + flag ;
    return degree ;
示例#3
0
def remove_redundant(pathdict):
    allpaths = list(pathdict.keys()) ;

    for path in allpaths:
        for key in pathdict.keys():
            flag = True ;
            if( path != key ):
                pathset = set( get_edge_list(path) ) ;
                keyset =  set( get_edge_list(key) ) ;
                if( pathset.issubset(keyset) ):
                    print "-----redundant trace-------"
                    del pathdict[key] ;
    return pathdict ;
示例#4
0
    def _add_provenance(self, mystr):
        edgelist = get_edge_list( mystr ) ;
        for edge in edgelist:
            self.edgedict[edge] = True ;

        self.prolist.append( edgelist ) ;
        self.tracelist.append( mystr ) ;
示例#5
0
def find_redudant(allpaths, pathdict):
    for path in allpaths:
        for key in pathdict.keys():
            flag = True ;
            if( path!=key ):
                pathset = set( get_edge_list(path) ) ;
                keyset =  set( get_edge_list(key) ) ;
                if( pathset.issubset(keyset) ):
                    print "-----redundant trace-------"
                    print path ;
                    print key ;
                    del pathdict[key] ;

    f = open("test-walk_checked_causality.txt", 'w')
    for path in pathdict.keys():
        f.write(path+"\n")  ;
    f.close() ;
    #for key in pathdict.keys():
    #    print key ;

    print len(pathdict) ;