Two vertices in a graph are called twins if they have the same neighbourhood. Twin reduction is the process in which twin vertices are merged, until no twin vertices remain. Note that this process is independent of the order in which pair of twins are chosen and merged.
As far as I know, there is no inbuilt function in sage, which returns a twin reduced graph from a given graph G. Can anyone help me in defining one such function?