MCPcopy Create free account
hub / github.com/alibaba/graph-learn / V

Method V

graphlearn/python/graph.py:544–584  ·  view source on GitHub ↗

Entry of GSL, starting from VERTEX. Args: t (string): The type of node which is the entry of query or the type of edge when node is from edge source or dst. feed (None| numpy.ndarray | types.GeneratorType | `Nodes`): When `feed` is not `None`, the `type` should be a

(self,
        t,
        feed=None,
        node_from=pywrap.NodeFrom.NODE,
        mask=utils.Mask.NONE)

Source from the content-addressed store, hash-verified

542 self._server = None
543
544 def V(self,
545 t,
546 feed=None,
547 node_from=pywrap.NodeFrom.NODE,
548 mask=utils.Mask.NONE):
549 """ Entry of GSL, starting from VERTEX.
550
551 Args:
552 t (string): The type of node which is the entry of query or the type
553 of edge when node is from edge source or dst.
554 feed (None| numpy.ndarray | types.GeneratorType | `Nodes`): When `feed`
555 is not `None`, the `type` should be a node type, which means query the
556 attributes of the specified node ids.
557 None: Default. Sample nodes with the following .shuffle and .batch API.
558 numpy.ndarray: Any shape of ids. Get nodes of the given ids and
559 node_type.
560 types.Generator: A generator of numpy.ndarray. Get nodes of generated
561 ids and given node_type.
562 `Nodes`: A `Nodes` object.
563 node_from (NodeFrom): Default is `NodeFrom.NODE`, which means sample or
564 or iterate node from node. `NodeFrom.EDGE_SRC` means sample or
565 iterate node from source node of edge, and `NodeFrom.EDGE_DST` means
566 sample or iterate node from destination node of edge. If node is from
567 edge, the `type` must be an edge type.
568 mask (NONE | TRAIN | TEST | VAL): The given node set is indexed by both the
569 raw node type and mask value. The default mask value is NONE, which plays
570 nothing on the index.
571 """
572 if feed is not None:
573 raise NotImplementedError("`feed` is not supported for now.")
574 dag = gsl.Dag(self)
575 params = {pywrap.kNodeType: utils.get_mask_type(t, mask),
576 pywrap.kNodeFrom: int(node_from)}
577 source_node = gsl.TraverseVertexDagNode(
578 dag, op_name="GetNodes", params=params)
579 source_node.set_output_field(pywrap.kNodeIds)
580 source_node.set_path(t, node_from)
581
582 # Add sink node to dag
583 gsl.SinkNode(dag)
584 return source_node
585
586 def E(self,
587 edge_type,

Callers

nothing calls this directly

Calls 3

set_output_fieldMethod · 0.80
set_pathMethod · 0.80
DagMethod · 0.45

Tested by

no test coverage detected