Unverified Commit 625f8a6b authored by Mingbang Wang's avatar Mingbang Wang Committed by GitHub
Browse files

[GraphBolt] Modify `from_dglgraph()` (#6470)

parent a6daf822
......@@ -825,7 +825,12 @@ def from_dglgraph(
include_original_edge_id: bool = False,
) -> CSCSamplingGraph:
"""Convert a DGLGraph to CSCSamplingGraph."""
homo_g, ntype_count, _ = to_homogeneous(g, return_count=True)
if is_homogeneous:
metadata = None
else:
# Initialize metadata.
node_type_to_id = {ntype: g.get_ntype_id(ntype) for ntype in g.ntypes}
edge_type_to_id = {
......
......@@ -1321,8 +1321,7 @@ def test_from_dglgraph_homogeneous():
assert gb_g.total_num_edges == dgl_g.num_edges()
assert torch.equal(gb_g.node_type_offset, torch.tensor([0, 1000]))
assert gb_g.type_per_edge is None
assert gb_g.metadata.node_type_to_id == {"_N": 0}
assert gb_g.metadata.edge_type_to_id == {"_N:_E:_N": 0}
assert gb_g.metadata is None
@unittest.skipIf(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment