MCPcopy Index your code
hub / github.com/networkx/networkx / update

Method update

networkx/utils/mapped_queue.py:207–217  ·  view source on GitHub ↗

Replace an element in the queue with a new one.

(self, elt, new, priority=None)

Source from the content-addressed store, hash-verified

205 return elt
206
207 def update(self, elt, new, priority=None):
208 """Replace an element in the queue with a new one."""
209 if priority is not None:
210 new = _HeapElement(priority, new)
211 # Replace
212 pos = self.position[elt]
213 self.heap[pos] = new
214 del self.position[elt]
215 self.position[new] = pos
216 # Restore invariant by sifting up
217 self._siftup(pos)
218
219 def remove(self, elt):
220 """Remove an element from the queue."""

Callers 13

_dict_to_numpy_array2Function · 0.45
_lazy_compileMethod · 0.45
__call__Method · 0.45
__new__Method · 0.45
convert_to_nxFunction · 0.45
test_update_leafMethod · 0.45
test_update_rootMethod · 0.45
test_update_leafMethod · 0.45

Calls 2

_siftupMethod · 0.95
_HeapElementClass · 0.85

Tested by 5

convert_to_nxFunction · 0.36
test_update_leafMethod · 0.36
test_update_rootMethod · 0.36
test_update_leafMethod · 0.36
test_update_rootMethod · 0.36