本文整理汇总了Python中Bio.Pathway.Rep.HashSet.empty方法的典型用法代码示例。如果您正苦于以下问题:Python HashSet.empty方法的具体用法?Python HashSet.empty怎么用?Python HashSet.empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.Pathway.Rep.HashSet
的用法示例。
在下文中一共展示了HashSet.empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_node
# 需要导入模块: from Bio.Pathway.Rep import HashSet [as 别名]
# 或者: from Bio.Pathway.Rep.HashSet import empty [as 别名]
def remove_node(self, node):
"""Removes node and all edges connected to it."""
if node not in self.__adjacency_list:
raise ValueError("Unknown node: " + str(node))
# remove node (and all out-edges) from adjacency list
del self.__adjacency_list[node]
# remove all in-edges from adjacency list
for n in self.__adjacency_list:
self.__adjacency_list[n] = HashSet(filter(lambda x,node=node: x[0] is not node,
self.__adjacency_list[n].list()))
# remove all refering pairs in label map
for label in self.__label_map.keys():
lm = HashSet(filter(lambda x,node=node: \
(x[0] is not node) and (x[1] is not node),
self.__label_map[label].list()))
# remove the entry completely if the label is now unused
if lm.empty():
del self.__label_map[label]
else:
self.__label_map[label] = lm