Recursive algorithm and branching for nonmaximal embeddings