LCA (Least Common Ancestor) search procedure must
take sub-graph without external connections to be able
to count depths of nodes. Previously, just 2 steps of
removing external connections were executed (1 time for
top sub-graph and 1 time for bottom one). In case if
originally top sub-graph had no external connections,
but bottom one had, after removing external nodes from
bottom sub-graph, some of the nodes from top sub-graph
could became external. In order to prevent that, removing
external connections must always be a loop until no
external connections found in both top and bottom sub-graphs.
Signed-off-by: Gladilov, Gleb <gleb.gladilov@intel.com>