Exemplo n.º 1
0
        static void Main1(string[] args)
        {
            WeightedGraph wg = new WeightedGraph("g.txt");
            Folyed        fb = new Folyed(wg);

            if (fb.hasNegCycle)
            {
                Console.WriteLine("exits negative cycle");
            }
            else
            {
                for (int i = 0; i < wg.V; i++)
                {
                    for (int k = 0; k < wg.V; k++)
                    {
                        Console.WriteLine($"{i}->{k}  : {fb.DistTo(i,k)}");
                    }
                }
                //foreach (var item in fb.Path(3))
                //{
                //    Console.WriteLine(item);
                //}
            }
        }
Exemplo n.º 2
0
        public static void Main1(string[] args)
        {
            WeightedGraph adjset = new WeightedGraph("g.txt", true);

            Console.Write(adjset.ToString());
        }