本文整理匯總了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