src/VertexColoring.Graphs/TrivialGraphFormatExtensions.cs
/// <summary>
/// Saves given <paramref name="coloring"/> into <paramref name="writer"/> in TGF-like text representation.
/// The color of each vertex is saved as a second number, after vertex id. So a vertex with id=1, label=sth
/// colored with number 132 will be saved in TGF vertex list as "1 132 sth".
/// </summary>
/// <param name="writer">Writer to save coloring to.</param>
/// <param name="graph">Coloring to be saved.</param>
Saves given  into  in TGF-like text representation.
The color of each vertex is saved as a second number, after vertex id. So a vertex with id=1, label=sth
colored with number 132 will be saved in TGF vertex list as "1 132 sth".
Saves given into in TGF - like text representation . The color of each vertex is saved as a second number after vertex id . So a vertex with id = 1 label = sth colored with number 132 will be saved in TGF vertex list as " 1 132 sth " .
public static void WriteColoringAsTgf(this TextWriter writer, GraphColoring coloring)
        {
            var graph = coloring.Graph;
            foreach (var vertex in graph.Vertices)
            {
                writer.WriteLine($"{vertex.Id} {coloring[vertex]} {vertex.Label}");
            }
            writer.WriteLine("#");
            foreach (var edge in graph.Edges)
            {
                writer.WriteLine(edge.ToString());
            }
        }
public static void WriteColoringAsTgf ( this TextWriter writer , GraphColoring coloring ) { var graph = coloring . Graph ; foreach ( var vertex in graph . Vertices ) { writer . WriteLine ( $" { vertex . Id } { coloring [ vertex ] } { vertex . Label } " ) ; } writer . WriteLine ( " " ) ; foreach ( var edge in graph . Edges ) { writer . WriteLine ( edge . ToString ( ) ) ; } }
Saves given  into  in TGF-like text representation.
Saves given into in TGF - like text representation .
TextWriter
this
coloring
GraphColoring
writer
Writer to save coloring to.
Writer to save coloring to .
graph
Coloring to be saved.
Coloring to be saved .