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

Function test_H_T_group

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

Source from the content-addressed store, hash-verified

496
497
498def test_H_T_group(g1):
499 import torch
500
501 g1.add_hyperedges([0, 4, 5], group_name="knn")
502 assert (
503 g1.H_T.to_dense().cpu()
504 == torch.tensor(
505 [
506 [1, 1, 0, 1],
507 [1, 1, 0, 0],
508 [1, 0, 1, 0],
509 [0, 0, 1, 0],
510 [0, 0, 1, 1],
511 [1, 0, 0, 1],
512 ]
513 ).t()
514 ).all()
515 assert (
516 g1.H_T_of_group("main").to_dense().cpu()
517 == torch.tensor(
518 [[1, 1, 0], [1, 1, 0], [1, 0, 1], [0, 0, 1], [0, 0, 1], [1, 0, 0]]
519 ).t()
520 ).all()
521 assert (
522 g1.H_T_of_group("knn").to_dense().cpu() == torch.tensor([[1, 0, 0, 0, 1, 1]])
523 ).all()
524
525
526def test_W_e(g2):

Callers

nothing calls this directly

Calls 2

H_T_of_groupMethod · 0.80
add_hyperedgesMethod · 0.45

Tested by

no test coverage detected