def sorted_nodes(self):
        """Returns a topological sort of the resource graph.

        Notes
        -----
        Topological sorts are not stable. Be wary of depending on order
        where you shouldn't.

        """
        if self._sorted_nodes is None:
            try:
                self._sorted_nodes = list(nx.algorithms.topological_sort(self.graph))
            except nx.NetworkXUnfeasible:
                raise ResourceError(
                    f"The resource pool contains at least one cycle: "
                    f"{nx.find_cycle(self.graph)}."
                )
        return self._sorted_nodes