You could simply use TerminalVertex(reduced) != pair.first, since in case reduced is not a terminal vertex it is caster to the null vertex