Added graph serialization code.