MCPcopy Index your code
hub / github.com/dmlc/dgl / test_issue1287

Function test_issue1287

tests/python/common/test_heterograph-remove.py:197–212  ·  view source on GitHub ↗
(idtype)

Source from the content-addressed store, hash-verified

195
196@parametrize_idtype
197def test_issue1287(idtype):
198 # reproduce https://github.com/dmlc/dgl/issues/1287.
199 # setting features after remove nodes
200 g = create_graph(idtype, 5)
201 g.add_edges([0, 2, 3, 1, 1], [1, 0, 3, 1, 0])
202 g.remove_nodes([0, 1])
203 g.ndata["h"] = F.randn((g.num_nodes(), 3))
204 g.edata["h"] = F.randn((g.num_edges(), 2))
205
206 # remove edges
207 g = create_graph(idtype, 5)
208 g.add_edges([0, 2, 3, 1, 1], [1, 0, 3, 1, 0])
209 g.remove_edges([0, 1])
210 g = g.to(F.ctx())
211 g.ndata["h"] = F.randn((g.num_nodes(), 3))
212 g.edata["h"] = F.randn((g.num_edges(), 2))
213
214
215if __name__ == "__main__":

Callers

nothing calls this directly

Calls 8

remove_nodesMethod · 0.80
remove_edgesMethod · 0.80
create_graphFunction · 0.70
add_edgesMethod · 0.45
num_nodesMethod · 0.45
num_edgesMethod · 0.45
toMethod · 0.45
ctxMethod · 0.45

Tested by

no test coverage detected