def connection_itr(self): """Returns a generator that will iterate through the source/target pairs (as specified by the iterator function, and create a connection rule based on the connector. """ conr = connector.create(self.connector, **(self.connector_params or {})) itr = iterator.create(self.iterator, conr, **({})) return itr(self.source_nodes, self.target_nodes, conr)
def connector(self, source_gids=None, target_gids=None, source_params=None, target_params=None, join_on=None, connection_type='all_to_all', connection_type_params=None, weight_function=None, weight_function_params=None): if connection_type_params is None: connection_type_params = {} source_nodes = list(self.nodes(source_params, source_gids)) target_nodes = list(self.nodes(target_params, target_gids)) cnct = connector.create(source_nodes, target_nodes, connector_type=connection_type, **connection_type_params) cnct.set_weight_function(weight_function, weight_function_params) cnct.set_join_keys(join_on) return cnct
def rule(self): return connector.create(self._rule, **(self._rule_params or {}))