Small modification - before searching for a path all edges are set as not parts of path. Now after editing cycle (adding edges or vertexes) program shows actual cycle (earlier it was coloring with green the edges that wasn't the parts of cycle).