Explicit initialization for previousEdge2 variable and check on number of iterations

previousEdge2 variable was not initialized (caused Run-Time warning in Visual Studio).
Added explicit initialization and helper variable for number of
iterations to only check previous edges after initial iteration.
Added check that all TargetSeedIds are found.