SamplingGraphΒΆ

class dgl.graphbolt.SamplingGraph[source]ΒΆ

Bases: object

Class for sampling graph.

copy_to_shared_memory(shared_memory_name: str)dgl.graphbolt.sampling_graph.SamplingGraph[source]ΒΆ

Copy the graph to shared memory.

Parameters

shared_memory_name (str) – Name of the shared memory.

Returns

The copied SamplingGraph object on shared memory.

Return type

SamplingGraph

to(device: torch.device)dgl.graphbolt.sampling_graph.SamplingGraph[source]ΒΆ

Copy graph to the specified device.

Parameters

device (torch.device) – The destination device.

Returns

The graph on the specified device.

Return type

SamplingGraph

property num_edgesΒΆ

The number of edges in the graph. - If the graph is homogenous, returns an integer. - If the graph is heterogenous, returns a dictionary.

Returns

The number of edges. Integer indicates the total edges number of a homogenous graph; dict indicates edges number per edge types of a heterogenous graph.

Return type

Union[int, Dict[str, int]]

property num_nodesΒΆ

The number of nodes in the graph. - If the graph is homogenous, returns an integer. - If the graph is heterogenous, returns a dictionary.

Returns

The number of nodes. Integer indicates the total nodes number of a homogenous graph; dict indicates nodes number per node types of a heterogenous graph.

Return type

Union[int, Dict[str, int]]