changed graph to commutative