  In this paper, we design a framework to obtain efficient algorithms for
several problems with a global constraint (acyclicity or connectivity) such as
Connected Dominating Set, Node Weighted Steiner Tree, Maximum Induced Tree,
Longest Induced Path, and Feedback Vertex Set. We design a meta-algorithm that
solves all these problems and whose running time is upper bounded by
$2^{O(k)}\cdot n^{O(1)}$, $2^{O(k \log(k))}\cdot n^{O(1)}$, $2^{O(k^2)}\cdot
n^{O(1)}$ and $n^{O(k)}$ where $k$ is respectively the clique-width,
$\mathbf{Q}$-rank-width, rank-width and maximum induced matching width of a
given decomposition. Our approach simplifies and unifies the known algorithms
for each of the parameters and its running time matches asymptotically also the
running times of the best known algorithms for basic NP-hard problems such as
Vertex Cover and Dominating Set. Our framework is based on the $d$-neighbor
equivalence defined in [Bui-Xuan, Telle and Vatshelle, TCS 2013] and the
rank-based approach introduced in [Bodlaender, Cygan, Kratsch and Nederlof,
ICALP 2013]. The results we obtain highlight the importance of the $d$-neighbor
equivalence relation on the algorithmic applications of width measures.
  We also prove that our framework could be useful for $W[1]$-hard problems
parameterized by clique-width such as Max Cut and Maximum Minimal Cut. For
these latter problems, we obtain $n^{O(k)}$, $n^{O(k)}$ and $n^{2^{O(k)}}$ time
algorithms where $k$ is respectively the clique-width, the
$\mathbf{Q}$-rank-width and the rank-width of the input graph.
