We construct infinite families of graphs that are determined by their generalized spectrum. This construction is based on new formulae for the determinant of the walk matrix of a graph. All graphs constructed here satisfy a certain extremal divisibility condition for the determinant of their walk matrix.