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

Function test_H_group

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

Source from the content-addressed store, hash-verified

456
457
458def test_H_group(g1):
459 import torch
460
461 g1.add_hyperedges([0, 4, 5], group_name="knn")
462 assert (
463 g1.H.to_dense().cpu()
464 == torch.tensor(
465 [
466 [1, 1, 0, 1],
467 [1, 1, 0, 0],
468 [1, 0, 1, 0],
469 [0, 0, 1, 0],
470 [0, 0, 1, 1],
471 [1, 0, 0, 1],
472 ]
473 )
474 ).all()
475 assert (
476 g1.H_of_group("main").to_dense().cpu()
477 == torch.tensor(
478 [[1, 1, 0], [1, 1, 0], [1, 0, 1], [0, 0, 1], [0, 0, 1], [1, 0, 0]]
479 )
480 ).all()
481 assert (
482 g1.H_of_group("knn").to_dense().cpu()
483 == torch.tensor([[1], [0], [0], [0], [1], [1]])
484 ).all()
485
486
487def test_H_T(g1):

Callers

nothing calls this directly

Calls 2

add_hyperedgesMethod · 0.45
H_of_groupMethod · 0.45

Tested by

no test coverage detected