@@ -123,6 +123,10 @@ def __eq__(self, other):
123123 return isinstance (other , Node ) and self .state == other .state
124124
125125 def __hash__ (self ):
126+ # We use the hash value of the state
127+ # stored in the node instead of the node
128+ # object itself to quickly search a node
129+ # with the same state in a Hash Table
126130 return hash (self .state )
127131
128132
@@ -353,14 +357,16 @@ def extend(U, open_dir, open_other, g_dir, g_other, closed_dir):
353357
354358 def find_min (open_dir , g ):
355359 """Finds minimum priority, g and f values in open_dir"""
356- m , m_f = np .inf , np .inf
360+ # pr_min_f isn't forward pr_min instead it's the f-value
361+ # of node with priority pr_min.
362+ pr_min , pr_min_f = np .inf , np .inf
357363 for n in open_dir :
358364 f = g [n ] + problem .h (n )
359365 pr = max (f , 2 * g [n ])
360- m = min (m , pr )
361- m_f = min (m_f , f )
366+ pr_min = min (pr_min , pr )
367+ pr_min_f = min (pr_min_f , f )
362368
363- return m , m_f , min (g .values ())
369+ return pr_min , pr_min_f , min (g .values ())
364370
365371 def find_key (pr_min , open_dir , g ):
366372 """Finds key in open_dir with value equal to pr_min
0 commit comments