MCPcopy
hub / github.com/dmlc/dgl / _check_subgraph

Function _check_subgraph

tests/python/common/test_subgraph.py:189–217  ·  view source on GitHub ↗
(g, sg)

Source from the content-addressed store, hash-verified

187 g.edges["follows"].data["h"] = y
188
189 def _check_subgraph(g, sg):
190 assert sg.idtype == g.idtype
191 assert sg.device == g.device
192 assert sg.ntypes == g.ntypes
193 assert sg.etypes == g.etypes
194 assert sg.canonical_etypes == g.canonical_etypes
195 assert F.array_equal(
196 F.tensor(sg.nodes["user"].data[dgl.NID]), F.tensor([1, 2], idtype)
197 )
198 assert F.array_equal(
199 F.tensor(sg.nodes["game"].data[dgl.NID]), F.tensor([0], idtype)
200 )
201 assert F.array_equal(
202 F.tensor(sg.edges["follows"].data[dgl.EID]), F.tensor([1], idtype)
203 )
204 assert F.array_equal(
205 F.tensor(sg.edges["plays"].data[dgl.EID]), F.tensor([1], idtype)
206 )
207 assert F.array_equal(
208 F.tensor(sg.edges["wishes"].data[dgl.EID]), F.tensor([1], idtype)
209 )
210 assert sg.num_nodes("developer") == 0
211 assert sg.num_edges("develops") == 0
212 assert F.array_equal(
213 sg.nodes["user"].data["h"], g.nodes["user"].data["h"][1:3]
214 )
215 assert F.array_equal(
216 sg.edges["follows"].data["h"], g.edges["follows"].data["h"][1:2]
217 )
218
219 sg1 = g.subgraph(
220 {

Callers 2

test_subgraph_maskFunction · 0.70
test_subgraph1Function · 0.70

Calls 2

num_nodesMethod · 0.45
num_edgesMethod · 0.45

Tested by

no test coverage detected