def process_edge_dijkstra(self, current, neighbor, pred, q, component):
        '''
        API: process_edge_dijkstra(self, current, neighbor, pred, q, component)
        Description:
        Used by search() method if the algo argument is 'Dijkstra'. Processes
        edges along Dijkstra's algorithm. User does not need to call this
        method directly.
        Input:
            current: Name of the current node.
            neighbor: Name of the neighbor node.
            pred: Predecessor tree.
            q: Data structure that holds nodes to be processed in a queue.
            component: component number.
        Post:
            'color' attribute of nodes and edges may change.
        '''
        if current is None:
            self.get_node(neighbor).set_attr('color', 'red')
            self.get_node(neighbor).set_attr('label', 0)
            q.push(neighbor, 0)
            self.display()
            self.get_node(neighbor).set_attr('color', 'black')
            return
        new_estimate = (q.get_priority(current) +
                        self.get_edge_attr(current, neighbor, 'cost'))
        if neighbor not in pred or new_estimate < q.get_priority(neighbor):
            pred[neighbor] = current
            self.get_node(neighbor).set_attr('color', 'red')
            self.get_node(neighbor).set_attr('label', new_estimate)
            q.push(neighbor, new_estimate)
            self.display()
            self.get_node(neighbor).set_attr('color', 'black')
def process_edge_dijkstra ( self , current , neighbor , pred , q , component ) : if current is None : self . get_node ( neighbor ) . set_attr ( 'color' , 'red' ) self . get_node ( neighbor ) . set_attr ( 'label' , 0 ) q . push ( neighbor , 0 ) self . display ( ) self . get_node ( neighbor ) . set_attr ( 'color' , 'black' ) return new_estimate = ( q . get_priority ( current ) + self . get_edge_attr ( current , neighbor , 'cost' ) ) if neighbor not in pred or new_estimate < q . get_priority ( neighbor ) : pred [ neighbor ] = current self . get_node ( neighbor ) . set_attr ( 'color' , 'red' ) self . get_node ( neighbor ) . set_attr ( 'label' , new_estimate ) q . push ( neighbor , new_estimate ) self . display ( ) self . get_node ( neighbor ) . set_attr ( 'color' , 'black' )
API: process_edge_dijkstra(self, current, neighbor, pred, q, component)
        Description:
        Used by search() method if the algo argument is 'Dijkstra'. Processes
        edges along Dijkstra's algorithm. User does not need to call this
        method directly.
        Input:
            current: Name of the current node.
            neighbor: Name of the neighbor node.
            pred: Predecessor tree.
            q: Data structure that holds nodes to be processed in a queue.
            component: component number.
        Post:
            'color' attribute of nodes and edges may change.