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
def ancestors(self): return set_union([parent.ancestors() for parent in self.parents] + [{self}])
def descendents(self): return set_union([chld.descendents() for chld in self.children] + [{self}])