public void Save(string path, GraphFileFormat fileFormat) { using (var writer = new StreamWriter(path)) { Save(writer, fileFormat); } }
public static OrientedGraph <T> Load(string path, GraphFileFormat fileFormat) { using (var fstream = new StreamReader(path)) { return(Load(fstream, fileFormat)); } }
public void Save(string filename) { Dictionary <ILinkable, int> linkable = new Dictionary <ILinkable, int>(); foreach (var o in objects) { linkable[o] = linkable.Count; } GraphFileFormat gff = new GraphFileFormat(); gff.numVertices = linkable.Count; gff.vertices = ArrayUtils.ConvertAll(ArrayUtils.ToArray(linkable.Keys), x => new VertexFormat() { edges = ArrayUtils.ConvertAll(ArrayUtils.ToArray(x.Edges), y => linkable[y.Key]), x = x.TopLeft.X, y = x.TopLeft.Y, numEdges = x.Edges.Count, color = x.MainControl.BackColor.ToArgb() }); using (FormattedWriter fw = new FormattedWriter(filename)) { fw.Write(gff); } }
public static OrientedGraph <T> Load(TextReader reader, GraphFileFormat fileFormat) { switch (fileFormat) { case GraphFileFormat.PlainTextAdjacencyMatrix: return(LoadFromPlainTextAdjacencyMatrix(reader)); case GraphFileFormat.GraphML: return(LoadFromGraphML(reader)); default: throw new NotImplementedException($"Support for '{fileFormat}' has not been implemented yet"); } }
public void Save(TextWriter writer, GraphFileFormat fileFormat) { switch (fileFormat) { case GraphFileFormat.GraphML: SaveAsGraphML(writer); break; case GraphFileFormat.PlainTextAdjacencyMatrix: SaveAsPlainTextAdjacencyMatrix(writer); break; default: throw new NotImplementedException($"Support for '{fileFormat}' has not been implemented yet"); } }