public static Graph LoadGraph(string content)
        {
            var           serializer    = new Serializer();
            GraphDocument graphDocument = serializer.Deserialize <GraphDocument>(content);

            return(ParseGraph(graphDocument));
        }
        private static Graph ParseGraph(GraphDocument graphDocument)
        {
            Graph graph = new Graph(graphDocument.id, graphDocument.name, new List <Entity>(), new List <Layer>());

            graphDocument.entities.ForEach(entity => graph.Entities.Add(ParseEntity(entity, graph)));
            graphDocument.layers.ForEach(layer => graph.AddLayer(ParseLayer(layer, graph)));

            return(graph);
        }
        public static string SaveGraph(Graph graph, bool emitAlias = false)
        {
            var settings = new SerializerSettings {
                EmitAlias = emitAlias
            };
            var           serializer    = new Serializer(settings);
            GraphDocument graphDocument = MakeGraphDocument(graph);

            return(serializer.Serialize(graphDocument));
        }