Esempio n. 1
0
        public void ABC137Test_FromEdges(string testCaseName)
        {
            ABC137Test_Core(testCaseName, (nodesCount, edgesCount, penalty, io) =>
            {
                var graph       = new WeightedGraph(nodesCount);
                var bellmanFord = new BellmanFord(nodesCount);

                for (int i = 0; i < edgesCount; i++)
                {
                    var abc = io.ReadIntArray(3);
                    var a   = abc[0] - 1;
                    var b   = abc[1] - 1;
                    var c   = abc[2];
                    bellmanFord.AddEdge(a, b, penalty - c);
                }

                return(bellmanFord);
            });
        }