Lewis structure
This algorithm is performed on a Lewis structure (a diagram that shows all valence electrons). Oxidation state equals the charge of an atom after each of its heteronuclear bonds has been assigned to the more-electronegative partner of the bond (except when that partner is a reversibly bonded Lewis-acid ligand) and homonuclear bonds have been divided equally: