using My.Collections;
using System;

namespace ShortestPath;

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

        var a = graph.AddNode("A");
        var b = graph.AddNode("B");
        var c = graph.AddNode("C");
        var d = graph.AddNode("D");
        var e = graph.AddNode("E");

        // Reihenfolge der Knoten zum Testen zufällig ändern
        graph.Shuffle();    
        Console.WriteLine(graph);

        graph.AddEdge(a, b, 10);
        graph.AddEdge(a, c, 20);
        graph.AddEdge(b, c, 5);
        //graph.AddEdge(b, c, -31); // Kante führt zu negativem Zyklus, Summe des Zyklus (A-B-C-A...)muss negativ werden: -1
        graph.AddEdge(c, a, 20);
        graph.AddEdge(c, d, 30);

        Console.WriteLine($"Von {a} nach {d}");

        (var path, var distance) = graph.BFS(a, d);
        Console.WriteLine($"Pfad (BFS)        : {string.Join(" -> ", path)}, Entfernung: {distance} Knoten");

        (path, distance) = graph.Dijkstra(a, d);
        Console.WriteLine($"Pfad (Dijkstra)   : {string.Join(" -> ", path)}, Entfernung: {distance} km");

        (path, distance) = graph.BellmanFord(a, d);
        Console.WriteLine($"Pfad (BellmanFord): {string.Join(" -> ", path)}, Entfernung: {distance} km");

        (path, distance) = graph.AStar(a, d, (start, end) => 0);
        Console.WriteLine($"Pfad (A*)           : {string.Join(" -> ", path)}, Entfernung: {distance} km");

        (path, distance) = graph.FloydWarshall(a, d);
        Console.WriteLine($"Pfad (FloydWarshall)  : {string.Join(" -> ", path)}, Entfernung: {distance} km");
    }
}