(g, sg)
| 1557 | g.edges["follows"].data["h"] = y |
| 1558 | |
| 1559 | def _check_subgraph(g, sg): |
| 1560 | assert sg.idtype == g.idtype |
| 1561 | assert sg.device == g.device |
| 1562 | assert sg.ntypes == g.ntypes |
| 1563 | assert sg.etypes == g.etypes |
| 1564 | assert sg.canonical_etypes == g.canonical_etypes |
| 1565 | assert F.array_equal( |
| 1566 | F.tensor(sg.nodes["user"].data[dgl.NID]), F.tensor([1, 2], idtype) |
| 1567 | ) |
| 1568 | assert F.array_equal( |
| 1569 | F.tensor(sg.nodes["game"].data[dgl.NID]), F.tensor([0], idtype) |
| 1570 | ) |
| 1571 | assert F.array_equal( |
| 1572 | F.tensor(sg.edges["follows"].data[dgl.EID]), F.tensor([1], idtype) |
| 1573 | ) |
| 1574 | assert F.array_equal( |
| 1575 | F.tensor(sg.edges["plays"].data[dgl.EID]), F.tensor([1], idtype) |
| 1576 | ) |
| 1577 | assert F.array_equal( |
| 1578 | F.tensor(sg.edges["wishes"].data[dgl.EID]), F.tensor([1], idtype) |
| 1579 | ) |
| 1580 | assert sg.num_nodes("developer") == 0 |
| 1581 | assert sg.num_edges("develops") == 0 |
| 1582 | assert F.array_equal( |
| 1583 | sg.nodes["user"].data["h"], g.nodes["user"].data["h"][1:3] |
| 1584 | ) |
| 1585 | assert F.array_equal( |
| 1586 | sg.edges["follows"].data["h"], g.edges["follows"].data["h"][1:2] |
| 1587 | ) |
| 1588 | |
| 1589 | sg1 = g.subgraph( |
| 1590 | { |
no test coverage detected