fixing graph so that it is unique