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

Method edge_sampler

graphlearn/python/graph.py:777–807  ·  view source on GitHub ↗

Sampler for sample one type of edges. Args: edge_type (string): Sample edges of the edge_type. batch_size (int, Optional): How many edges will be returned for get(). strategy (string, Optional):Indicates how to sample edges, "by_order", "random" and "shuffle" are suppo

(self,
                   edge_type,
                   batch_size=64,
                   strategy="by_order",
                   mask=utils.Mask.NONE)

Source from the content-addressed store, hash-verified

775 mask=mask)
776
777 def edge_sampler(self,
778 edge_type,
779 batch_size=64,
780 strategy="by_order",
781 mask=utils.Mask.NONE):
782 """Sampler for sample one type of edges.
783
784 Args:
785 edge_type (string): Sample edges of the edge_type.
786 batch_size (int, Optional): How many edges will be returned for get().
787 strategy (string, Optional):Indicates how to sample edges,
788 "by_order", "random" and "shuffle" are supported.
789 "by_order": Get edge by order. Raise `graphlearn.OutOfRangeError` when
790 all the edges are visited. Each edge will be visited and only be
791 visited once.
792 "random": Randomly get edges. No visting state will be hold, so out of
793 range will not happened.
794 "shuffle": Get edges with shuffle. Raise `graphlearn.OutOfRangeError`
795 when all the edges are visited. Each edge will be visited and only
796 be visited once.
797
798 Return:
799 An `EdgeSampler` object.
800
801 """
802 sampler = utils.strategy2op(strategy, "EdgeSampler")
803 return getattr(samplers, sampler)(self,
804 edge_type,
805 batch_size=batch_size,
806 strategy=strategy,
807 mask=mask)
808
809 def neighbor_sampler(self,
810 meta_path,

Callers 2

test_edge_iterateMethod · 0.80
__init__Method · 0.80

Calls

no outgoing calls

Tested by 1

test_edge_iterateMethod · 0.64