Add graph factory equals and serialization. Add unit tests.