using My.Collections;
using System;

namespace Coloring;

class Program
{
    static void Main()
    {
        var graph = new ColoredGraph<string>();

        var a = graph.AddNode("A");
        var b = graph.AddNode("B");
        var c = graph.AddNode("C");
        var e = graph.AddNode("E");    // E vertauschen mit D, dann enthält D noch keine Farbe und es wird eine mehr benutzt
        var d = graph.AddNode("D");

        graph.AddEdge(a, b);
        graph.AddEdge(a, c);
        graph.AddEdge(b, c);
        graph.AddEdge(b, d);
        graph.AddEdge(c, d);
        graph.AddEdge(d, e);

        var colors = new string[] { "Rot", "Blau", "Gelb", "Grün" };

        Console.WriteLine("Greedy");
        graph.GreedyColoring();
        foreach (dynamic n in graph.Nodes)
        {
            Console.WriteLine($"{n.Item}: {n.Color} ({colors[n.Color]})");
        }

        Console.WriteLine("Welsh Powell");
        graph.WelshPowellColoring();
        foreach (dynamic n in graph.Nodes)
        {
            Console.WriteLine($"{n.Item}: {n.Color} ({colors[n.Color]})");
        }

        Console.WriteLine("Backtracking");
        graph.BacktrackingColoring();
        foreach (dynamic n in graph.Nodes)
        {
            Console.WriteLine($"{n.Item}: {n.Color} ({colors[n.Color]})");
        }

        string dot = graph.GenerateDotRepresentation();
        Console.WriteLine("\nDOT Language:\n" + dot);
    }
}
