MCPcopy Create free account
hub / github.com/alibaba/GraphScope / to_numpy

Method to_numpy

python/graphscope/framework/graph.py:424–441  ·  view source on GitHub ↗

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

(self, selector, vertex_range=None)

Source from the content-addressed store, hash-verified

422 self._unload_op = dag_utils.unload_graph(self)
423
424 def to_numpy(self, selector, vertex_range=None):
425 """Select some elements of the graph and output to numpy.
426
427 Args:
428 selector (str): Select a portion of graph as a numpy.ndarray.
429 vertex_range(dict, optional): Slice vertices. Defaults to None.
430
431 Returns:
432 :class:`graphscope.framework.context.ResultDAGNode`:
433 A result holds the `numpy.ndarray`, evaluated in eager mode.
434 """
435 # avoid circular import
436 from graphscope.framework.context import ResultDAGNode
437
438 check_argument(self.graph_type == graph_def_pb2.ARROW_PROPERTY)
439 vertex_range = utils.transform_vertex_range(vertex_range)
440 op = dag_utils.graph_to_numpy(self, selector, vertex_range)
441 return ResultDAGNode(self, op)
442
443 def to_dataframe(self, selector, vertex_range=None):
444 """Select some elements of the graph and output as a pandas.DataFrame

Callers

nothing calls this directly

Calls 2

check_argumentFunction · 0.90
ResultDAGNodeClass · 0.90

Tested by

no test coverage detected