MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / remove_element

Method remove_element

graphs/multi_heuristic_astar.py:39–48  ·  view source on GitHub ↗
(self, item)

Source from the content-addressed store, hash-verified

37 heapq.heappush(self.elements, (pro, xxx))
38
39 def remove_element(self, item):
40 if item in self.set:
41 self.set.remove(item)
42 temp = []
43 (pro, x) = heapq.heappop(self.elements)
44 while x != item:
45 temp.append((pro, x))
46 (pro, x) = heapq.heappop(self.elements)
47 for prito, yyy in temp:
48 heapq.heappush(self.elements, (prito, yyy))
49
50 def top_show(self):
51 return self.elements[0][1]

Callers 1

expand_stateFunction · 0.80

Calls 2

removeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected