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

Method _resolve_op

python/graphscope/framework/graph.py:393–422  ·  view source on GitHub ↗
(self, incoming_data)

Source from the content-addressed store, hash-verified

391 return graph_dag_node
392
393 def _resolve_op(self, incoming_data):
394 if incoming_data is None:
395 # create dag node of empty graph
396 self._op = self._construct_op_of_empty_graph()
397 elif isinstance(incoming_data, Operation):
398 self._op = incoming_data
399 if self._op.type == types_pb2.PROJECT_TO_SIMPLE:
400 self._graph_type = graph_def_pb2.ARROW_PROJECTED
401 elif isinstance(incoming_data, Graph):
402 self._op = dag_utils.copy_graph(incoming_data)
403 self._graph_type = incoming_data.graph_type
404 elif isinstance(incoming_data, GraphDAGNode):
405 if incoming_data.session_id != self.session_id:
406 raise RuntimeError(f"{incoming_data} not in the same session.")
407 raise NotImplementedError
408 elif vineyard is not None and isinstance(
409 incoming_data, (vineyard.Object, vineyard.ObjectID, vineyard.ObjectName)
410 ):
411 self._op = self._from_vineyard(incoming_data)
412 else:
413 # Don't import the :code:`NXGraph` in top-level statements to improve the
414 # performance of :code:`import graphscope`.
415 from graphscope import nx
416
417 if isinstance(incoming_data, nx.classes.graph._GraphBase):
418 self._op = self._from_nx_graph(incoming_data)
419 else:
420 raise RuntimeError("Not supported incoming data.")
421 # update the unload op
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.

Callers 1

__init__Method · 0.95

Calls 3

_from_nx_graphMethod · 0.80
_from_vineyardMethod · 0.45

Tested by

no test coverage detected