MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / test_N_group

Function test_N_group

easygraph/classes/tests/test_hypergraph.py:649–660  ·  view source on GitHub ↗
(g1)

Source from the content-addressed store, hash-verified

647
648
649def test_N_group(g1):
650 import torch
651
652 assert (g1.N_v(1).cpu() == torch.tensor([0, 1])).all()
653 assert (g1.N_e(1).cpu() == torch.tensor([0, 1])).all()
654 g1.add_hyperedges([[0, 1], [1, 2]], group_name="knn")
655 assert (g1.N_v(1).cpu() == torch.tensor([0, 1])).all()
656 assert (g1.N_e(1).cpu() == torch.tensor([0, 1, 3, 4])).all()
657 assert (g1.N_v_of_group(1, "main").cpu() == torch.tensor([0, 1])).all()
658 assert (g1.N_e_of_group(2, "main").cpu() == torch.tensor([0, 2])).all()
659 assert (g1.N_v_of_group(1, "knn").cpu() == torch.tensor([1, 2])).all()
660 assert (g1.N_e_of_group(1, "knn").cpu() == torch.tensor([0, 1])).all()
661
662
663@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 5

N_eMethod · 0.80
N_v_of_groupMethod · 0.80
N_e_of_groupMethod · 0.80
N_vMethod · 0.45
add_hyperedgesMethod · 0.45

Tested by

no test coverage detected