def get_node_map(node_set):
    """
    Maps every node to an ID.

    :param node_set: set of all nodes to be mapped.
    :return: dict of original node index as key and the mapped ID as value.
    """
    nodes = list(node_set)
    nodes.sort()

    node_id_map = {}
    for i, n in enumerate(nodes):
        node_id_map[n] = i

    return node_id_map