graph theory to grass cutter