def __make_xpointer_compatible(self):
        """
        ensure that all node and IDs in the document graph are valid
        xpointer IDs. this will relabel all node IDs in place in the discourse
        graph and change its ``.tokens`` list accordingly.
        """

        node_id_map = {node: ensure_xpointer_compatibility(node)
                       for node in self.dg.nodes_iter()}

        old_token_ids = self.dg.tokens
        # replace document graph with node relabeled version
        self.dg = relabel_nodes(self.dg, node_id_map, copy=True)
        self.dg.tokens = [node_id_map[tok] for tok in old_token_ids]