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

Method E

graphlearn/python/graph.py:586–618  ·  view source on GitHub ↗

Entry of GSL, starting from EDGE. Args: 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

(self,
        edge_type,
        feed=None,
        reverse=False)

Source from the content-addressed store, hash-verified

584 return source_node
585
586 def E(self,
587 edge_type,
588 feed=None,
589 reverse=False):
590 """ Entry of GSL, starting from EDGE.
591
592 Args:
593 edge_type (string): The type of edge which is the entry of query.
594 feed (None| (np.ndarray, np.ndarray) | types.GeneratorType | `Edges`):
595 None: Default. Sample edges with the following .shuffle and .batch API.
596 (np.ndarray, np.ndarray): src_ids, dst_ids. Get edges of the given
597 (src_ids, dst_ids) and given edge_type. src_ids and dst_ids must be
598 the same shape, dtype is int.
599 types.Generator: A generator of (numpy.ndarray, numpy.ndarray). Get
600 edges of generated (src_ids, dst_ids) and given edge_type.
601 `Edges`: An `Edges` object.
602 """
603 if feed is not None:
604 raise NotImplementedError("`feed` is not supported for now.")
605 dag = gsl.Dag(self)
606 if reverse:
607 edge_type = edge_type + "_reverse"
608
609 dag = gsl.Dag(self)
610 params = {pywrap.kEdgeType: edge_type}
611 source_node = gsl.TraverseSourceEdgeDagNode(
612 dag, op_name="GetEdges", params=params)
613 source_node.set_output_field(pywrap.kEdgeIds)
614 source_node.set_path(edge_type, pywrap.NodeFrom.NODE)
615
616 # Add sink node to dag
617 gsl.SinkNode(dag)
618 return source_node
619
620 def get_topology(self):
621 """ Get the topology of the graph.

Callers 15

desc_queryMethod · 0.80
test_weighted_labeledMethod · 0.80
test_labeledMethod · 0.80
test_weightedMethod · 0.80
test_edge_shuffleMethod · 0.80

Calls 3

set_output_fieldMethod · 0.80
set_pathMethod · 0.80
DagMethod · 0.45

Tested by 15

desc_queryMethod · 0.64
test_weighted_labeledMethod · 0.64
test_labeledMethod · 0.64
test_weightedMethod · 0.64
test_edge_shuffleMethod · 0.64