예제 #1
0
파일: rules.py 프로젝트: silky/d_separation
def bind_arguments(bind, args):
    """
    arguments:
        bind : function variable -> vertex set
        args : {arg_name : [variable, ...], ...}
    return value:
        bound_args : {arg_name : vertex set, ...}
    """

    result = {}
    for arg_name, v_exprs in args.iteritems():
        symbols = map(E.unpack_v, v_exprs)
        subsets = map(bind, symbols)
        result[arg_name] = set_union(subsets)
    return result
예제 #2
0
 def ancestors(self):
     return set_union([parent.ancestors()
                       for parent in self.parents] + [{self}])
예제 #3
0
 def descendents(self):
     return set_union([chld.descendents()
                       for chld in self.children] + [{self}])