You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
dhg\structure\hypergraphs\hypergraph.py 的 add_hyperedges() 函数
//判断e_weight类型ife_weightisNone:
e_weight= [1.0] *len(e_list)
eliftype(e_weight) in (int, float):
e_weight= [e_weight] //这里错误应该是 [e_weight] *len(e_list) 否则过不了下面的asserteliftype(e_weight) islist:
passelse:
raiseTypeError(f"The type of e_weight should be float or list, but got {type(e_weight)}")
assertlen(e_list) ==len(e_weight), "The number of hyperedges and the number of weights are not equal."
Traceback (most recent call last):
File "D:\test.py", line 3, in<module>
hg = Hypergraph(4, [[0, 1, 2], [1, 2, 3]], e_weight=0.8)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxx\miniforge3\envs\task_hg\Lib\site-packages\dhg\structure\hypergraphs\hypergraph.py", line 48, in __init__
self.add_hyperedges(e_list, e_weight, merge_op=merge_op)
File "C:\Users\xxx\miniforge3\envs\task_hg\Lib\site-packages\dhg\structure\hypergraphs\hypergraph.py", line 345, in add_hyperedges
assert len(e_list) == len(e_weight), "The number of hyperedges and the number of weights are not equal."
AssertionError: The number of hyperedges and the number of weights are not equal.
Describe the bug
dhg\structure\hypergraphs\hypergraph.py 的 add_hyperedges() 函数
To Reproduce
执行下面这段代码
显示
Expected behavior
e_weight 应该被正确设置为 [e_weight] * len(e_list)
The text was updated successfully, but these errors were encountered: