dgl.partition_graph_with_halo

dgl.partition_graph_with_halo(g, node_part, extra_cached_hops, reshuffle=False)[source]

对图进行分区。

根据给定的每个分区的节点分配,该函数将输入图分割成子图。子图可能包含HALO节点,这些节点不属于子图的分区,但在固定的跳数内连接到分区中的节点。

If reshuffle is turned on, the function reshuffles node IDs and edge IDs of the input graph before partitioning. After reshuffling, all nodes and edges in a partition fall in a contiguous ID range in the input graph. The partitioend subgraphs have node data ‘orig_id’, which stores the node IDs in the original input graph.

Parameters:
  • g (DGLGraph) – The graph to be partitioned

  • node_part (1D tensor) – 指定节点被分配到哪个分区。此张量的长度需要与图的节点数量相同。每个元素表示一个节点的分区ID。

  • extra_cached_hops (int) – The number of hops a HALO node can be accessed.

  • reshuffle (bool) – Resuffle nodes so that nodes in the same partition are in the same ID range.

Returns:

  • DGLGraphs的字典 – 键是分区ID,值是分区的DGLGraph。

  • Tensor – 如果‘reshuffle=True’,则存储重新洗牌后的节点ID与原始节点ID之间映射的一维张量。否则,返回None。

  • Tensor – 如果‘reshuffle=True’,则存储重新洗牌后的边ID与原始边ID之间映射的一维张量。否则,返回None。