We also prove that [Independent Feedback Vertex Set]{} is polynomial-time solvable for graphs of diameter $2$. This generalises the result of Yang and Yuan [@YY06] for [Near-Bipartiteness]{} restricted to graphs of diameter $2$.

\[t-main\] Let $k\geq 0$ be an integer.

(i) If $k\leq 2$, then [Independent Feedback Vertex Set]{} (and thus [Near-Bipartiteness]{}) is polynomial-time solvable for graphs of diameter $k$.\

(ii) If $k\geq 3$, then [Near-Bipartiteness]{} (and thus [Independent Feedback Vertex Set]{}) is [[NP]{}]{}-complete for graphs of diameter $k$.

We prove Theorem \[t-main\] (i) in Section \[s-poly\]. Yang and Yuan [@YY06] proved their result for [Near-Bipartiteness]{} by giving a polynomial-time verifiable characterisation of the class of near-bipartite graphs of diameter $2$. We use their characterisation as the starting point for our algorithm for [Independent Feedback Vertex Set]{}. In fact our algorithm not only solves the decision problem but even finds a minimum independent feedback vertex set in a graph of diameter $2$.

We prove Theorem \[t-main\] (ii) in Section \[s-diam3\] by using a construction of Mertzios and Spirakis [@MS16], which they used to prove that [$3$-Colouring]{} is [[NP]{}]{}-complete for graphs of diameter $3$. The outline of their proof is straightforward: a reduction from [$3$-Satisfiability]{} that constructs, for any instance $\phi$, 