Graph Learning#

class graphscope.learning.graph.Graph(*args: Any, **kwargs: Any)[source]#
E(edge_type, feed=None, reverse=False)[source]#

Entry of GSL, starting from EDGE.

  • edge_type (string) – The type of edge which is the entry of query.

  • feed (None| (np.ndarray, np.ndarray) | types.GeneratorType | Edges) –

    • None: Default. Sample edges with the following .shuffle and .batch API. (np.ndarray, np.ndarray): src_ids, dst_ids. Get edges of the given (src_ids, dst_ids) and given edge_type. src_ids and dst_ids must be the same shape, dtype is int.

    • types.Generator: A generator of (numpy.ndarray, numpy.ndarray). Get edges of generated (src_ids, dst_ids) and given edge_type.

    • Edges: An Edges object.

V(t, feed=None, node_from=graphlearn.pywrap.NodeFrom.NODE, mask=graphlearn.python.utils.Mask.NONE)[source]#

Entry of GSL, starting from VERTEX.

  • 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 node type, which means query the attributes of the specified node ids.

    • None: Default. Sample nodes with the following .shuffle and .batch API. numpy.ndarray: Any shape of ids. Get nodes of the given ids and node_type.

    • types.Generator: A generator of numpy.ndarray. Get nodes of generated ids and given node_type.

    • Nodes: A Nodes object.

  • node_from (NodeFrom) – Default is NodeFrom.NODE, which means sample or or iterate node from node. NodeFrom.EDGE_SRC means sample or iterate node from source node of edge, and NodeFrom.EDGE_DST means sample or iterate node from destination node of edge. If node is from edge, the type must be an edge type.

  • mask (NONE | TRAIN | TEST | VAL) – The given node set is indexed by both the raw node type and mask value. The default mask value is NONE, which plays nothing on the index.

__init__(graph, handle, config=None, object_id=None)[source]#

Initialize a graph for the learning engine using a handle.


Return a base64-encoded handle for distributed training.