def to_numpy(self, selector, vertex_range=None): """Select some elements of the graph and output to numpy. Args: selector (str): Select a portion of graph as a numpy.ndarray. vertex_range(dict, optional): Slice vertices. Defaults to None. Returns: `numpy.ndarray` """ self.check_unmodified() selector = transform_labeled_vertex_property_data_selector(self, selector) vertex_range = transform_vertex_range(vertex_range) op = graph_to_numpy(self, selector, vertex_range) ret = op.eval() return decode_numpy(ret)
def to_numpy(self, selector, vertex_range=None): """Select some elements of the graph and output to numpy. Args: selector (str): Select a portion of graph as a numpy.ndarray. vertex_range(dict, optional): Slice vertices. Defaults to None. Returns: `numpy.ndarray` """ check_argument(self.graph_type == types_pb2.ARROW_PROPERTY) self._ensure_loaded() self._check_unmodified() selector = utils.transform_labeled_vertex_property_data_selector( self, selector) vertex_range = utils.transform_vertex_range(vertex_range) op = dag_utils.graph_to_numpy(self, selector, vertex_range) ret = op.eval() return utils.decode_numpy(ret)
def to_numpy(self, selector, vertex_range=None): """Select some elements of the graph and output to numpy. Args: selector (str): Select a portion of graph as a numpy.ndarray. vertex_range(dict, optional): Slice vertices. Defaults to None. Returns: :class:`graphscope.framework.context.ResultDAGNode`: A result holds the `numpy.ndarray`, evaluated in eager mode. """ # avoid circular import from graphscope.framework.context import ResultDAGNode check_argument(self.graph_type == graph_def_pb2.ARROW_PROPERTY) vertex_range = utils.transform_vertex_range(vertex_range) op = dag_utils.graph_to_numpy(self, selector, vertex_range) return ResultDAGNode(self, op)