def min_distance(queue, dist):
    """
    Returns node with smallest distance in queue
    """
    min_node = None
    for node in queue:
        if min_node is None:
            min_node = node
        elif dist[node] < dist[min_node]:
            min_node = node

    return min_node