public static void SaveGraphToFile(this IFsm fsm, string fileName) { using (var stream = File.OpenWrite(fileName)) { stream.SetLength(0); new XmlSerializer(typeof(Dgml.DirectedGraph)).Serialize(stream, fsm.BuildGraph().ToDgml()); } }