Algorithm planar laying graph and concurrent validation, whether it is planar