MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

graphs/dijkstra_algorithm.py:13–28  ·  view source on GitHub ↗

Priority queue class constructor method. Examples: >>> priority_queue_test = PriorityQueue() >>> priority_queue_test.cur_size 0 >>> priority_queue_test.array [] >>> priority_queue_test.pos {}

(self)

Source from the content-addressed store, hash-verified

11class PriorityQueue:
12 # Based on Min Heap
13 def __init__(self):
14 """
15 Priority queue class constructor method.
16
17 Examples:
18 >>> priority_queue_test = PriorityQueue()
19 >>> priority_queue_test.cur_size
20 0
21 >>> priority_queue_test.array
22 []
23 >>> priority_queue_test.pos
24 {}
25 """
26 self.cur_size = 0
27 self.array = []
28 self.pos = {} # To store the pos of node in array
29
30 def is_empty(self):
31 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected