def GetNextNodeID(nodes, dist):
    """ return node ID with the minimum distance label from a set of nodes """
    # empty nodes
    if not nodes:
        raise Exception('Empty Scan Eligible List!!')

    nodeID = nodes[0]
    min_ = dist[nodeID]
    for i in nodes:
        if dist[i] < min_:
            min_ = dist[i]
            nodeID = i

    return nodeID