public void DijkstraIntTest1()
        {
            var n1 = new SingleSourceShortestPaths.N();
            var n2 = new SingleSourceShortestPaths.N();
            var n3 = new SingleSourceShortestPaths.N();
            var n4 = new SingleSourceShortestPaths.N();
            var n5 = new SingleSourceShortestPaths.N();

            n1.Edges.Add(new SingleSourceShortestPaths.E() { Length = 10, ToNode = 1 });
            n1.Edges.Add(new SingleSourceShortestPaths.E() { Length = 30, ToNode = 3 });
            n1.Edges.Add(new SingleSourceShortestPaths.E() { Length = 100, ToNode = 4 });

            n2.Edges.Add(new SingleSourceShortestPaths.E() { Length = 50, ToNode = 2 });

            n3.Edges.Add(new SingleSourceShortestPaths.E() { Length = 10, ToNode = 4 });

            n4.Edges.Add(new SingleSourceShortestPaths.E() { Length = 20, ToNode = 2 });
            n4.Edges.Add(new SingleSourceShortestPaths.E() { Length = 60, ToNode = 4 });

            var nodes = new[] { n1, n2, n3, n4, n5 };

            var d = SingleSourceShortestPaths.Dijkstra(nodes, 0);
            Assert.Equal(0ul, d[0]);
            Assert.Equal(10ul, d[1]);
            Assert.Equal(50ul, d[2]);
            Assert.Equal(30ul, d[3]);
            Assert.Equal(60ul, d[4]);
        }
        public void DijkstraIntTest2()
        {
            var n1 = new SingleSourceShortestPaths.N();
            var n2 = new SingleSourceShortestPaths.N();
            var n3 = new SingleSourceShortestPaths.N();
            var n4 = new SingleSourceShortestPaths.N();
            var n5 = new SingleSourceShortestPaths.N();
            var n6 = new SingleSourceShortestPaths.N();

            n1.Edges.Add(new SingleSourceShortestPaths.E() { Length = 50, ToNode = 1 });
            n1.Edges.Add(new SingleSourceShortestPaths.E() { Length = 10, ToNode = 2 });
            n1.Edges.Add(new SingleSourceShortestPaths.E() { Length = 45, ToNode = 4 });

            n2.Edges.Add(new SingleSourceShortestPaths.E() { Length = 10, ToNode = 4 });

            n3.Edges.Add(new SingleSourceShortestPaths.E() { Length = 20, ToNode = 0 });
            n3.Edges.Add(new SingleSourceShortestPaths.E() { Length = 15, ToNode = 3 });

            n4.Edges.Add(new SingleSourceShortestPaths.E() { Length = 20, ToNode = 1 });
            n4.Edges.Add(new SingleSourceShortestPaths.E() { Length = 35, ToNode = 4 });

            n5.Edges.Add(new SingleSourceShortestPaths.E() { Length = 30, ToNode = 3 });

            n6.Edges.Add(new SingleSourceShortestPaths.E() { Length = 3, ToNode = 3 });

            var nodes = new[] { n1, n2, n3, n4, n5, n6 };

            var d = SingleSourceShortestPaths.Dijkstra(nodes, 0);
            Assert.Equal(0ul, d[0]);
            Assert.Equal(45ul, d[1]);
            Assert.Equal(10ul, d[2]);
            Assert.Equal(25ul, d[3]);
            Assert.Equal(45ul, d[4]);
            Assert.Equal(ulong.MaxValue, d[5]);

            d = SingleSourceShortestPaths.Dijkstra(nodes, 4);
            Assert.Equal(ulong.MaxValue, d[0]);
            Assert.Equal(50ul, d[1]);
            Assert.Equal(ulong.MaxValue, d[2]);
            Assert.Equal(30ul, d[3]);
            Assert.Equal(0ul, d[4]);
            Assert.Equal(ulong.MaxValue, d[5]);

            d = SingleSourceShortestPaths.Dijkstra(nodes, 5);
            Assert.Equal(ulong.MaxValue, d[0]);
            Assert.Equal(23ul, d[1]);
            Assert.Equal(ulong.MaxValue, d[2]);
            Assert.Equal(3ul, d[3]);
            Assert.Equal(33ul, d[4]);
            Assert.Equal(0ul, d[5]);
        }