store wagner min cut algorithm