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

Method remove_hyperedges

easygraph/classes/hypergraph.py:371–396  ·  view source on GitHub ↗

r"""Remove the specified hyperedges from the hypergraph. Args: ``e_list`` (``Union[List[int], List[List[int]]]``): A list of hyperedges describes how the vertices point to the hyperedges. ``group_name`` (``str``, optional): Remove these hyperedges from the specified

(
        self,
        e_list: Union[List[int], List[List[int]]],
        group_name: Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

369 self.add_hyperedges(e_list, group_name=group_name)
370
371 def remove_hyperedges(
372 self,
373 e_list: Union[List[int], List[List[int]]],
374 group_name: Optional[str] = None,
375 ):
376 r"""Remove the specified hyperedges from the hypergraph.
377
378 Args:
379 ``e_list`` (``Union[List[int], List[List[int]]]``): A list of hyperedges describes how the vertices point to the hyperedges.
380 ``group_name`` (``str``, optional): Remove these hyperedges from the specified hyperedge group. If not specified, the function will
381 remove those hyperedges from all hyperedge groups. Defaults to the ``None``.
382 """
383 assert (
384 group_name is None or group_name in self.group_names
385 ), "The specified group_name is not in existing hyperedge groups."
386 e_list = self._format_e_list(e_list)
387 if group_name is None:
388 for _idx in range(len(e_list)):
389 e_code = self._hyperedge_code(e_list[_idx], e_list[_idx])
390 for name in self.group_names:
391 self._raw_groups[name].pop(e_code, None)
392 else:
393 for _idx in range(len(e_list)):
394 e_code = self._hyperedge_code(e_list[_idx], e_list[_idx])
395 self._raw_groups[group_name].pop(e_code, None)
396 self._clear_cache(group_name)
397
398 def remove_group(self, group_name: str):
399 r"""Remove the specified hyperedge group from the hypergraph.

Callers

nothing calls this directly

Calls 4

_format_e_listMethod · 0.80
_hyperedge_codeMethod · 0.80
popMethod · 0.80
_clear_cacheMethod · 0.45

Tested by

no test coverage detected