Update grid detection

Add extedGridGroup() function so that the edges which are separate from
the connected component sill have some chance to be a member of the
group.