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

Method _format_e_list

easygraph/classes/base.py:182–198  ·  view source on GitHub ↗

r"""Format the hyperedge list. Args: ``e_list`` (``List[int]`` or ``List[List[int]]``): The hyperedge list.

(e_list: Union[List[int], List[List[int]]])

Source from the content-addressed store, hash-verified

180
181 @staticmethod
182 def _format_e_list(e_list: Union[List[int], List[List[int]]]) -> List[List[int]]:
183 r"""Format the hyperedge list.
184
185 Args:
186 ``e_list`` (``List[int]`` or ``List[List[int]]``): The hyperedge list.
187 """
188 if type(e_list[0]) in (int, float):
189 return [tuple(sorted(e_list))]
190 elif type(e_list) == tuple:
191 e_list = list(e_list)
192 elif type(e_list) == list:
193 pass
194 else:
195 raise TypeError("e_list must be List[int] or List[List[int]].")
196 for _idx in range(len(e_list)):
197 e_list[_idx] = tuple(sorted(e_list[_idx]))
198 return e_list
199
200 @staticmethod
201 def _format_e_list_and_w_on_them(

Callers 3

remove_hyperedgesMethod · 0.95
add_hyperedgesMethod · 0.80
remove_hyperedgesMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected