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

Function test_D_group

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

Source from the content-addressed store, hash-verified

550
551
552def test_D_group(g1):
553 import torch
554
555 assert (g1.D_v.cpu()._values() == torch.tensor([2, 2, 2, 1, 1, 1])).all()
556 assert (g1.D_e.cpu()._values() == torch.tensor([4, 2, 3])).all()
557 g1.add_hyperedges([[0, 2], [1, 2, 3]], group_name="knn")
558 assert (g1.D_v.cpu()._values() == torch.tensor([3, 3, 4, 2, 1, 1])).all()
559 assert (g1.D_e.cpu()._values() == torch.tensor([4, 2, 3, 2, 3])).all()
560 assert (
561 g1.D_v_of_group("main").cpu()._values() == torch.tensor([2, 2, 2, 1, 1, 1])
562 ).all()
563 assert (g1.D_e_of_group("main").cpu()._values() == torch.tensor([4, 2, 3])).all()
564 assert (
565 g1.D_v_of_group("knn").cpu()._values() == torch.tensor([1, 1, 2, 1, 0, 0])
566 ).all()
567 assert (g1.D_e_of_group("knn").cpu()._values() == torch.tensor([2, 3])).all()
568
569
570def test_D_neg(g1, g2):

Callers

nothing calls this directly

Calls 3

D_v_of_groupMethod · 0.80
D_e_of_groupMethod · 0.80
add_hyperedgesMethod · 0.45

Tested by

no test coverage detected