public List <Cost> FindMinimumCost() { var reducer = new Reducer(_graph); reducer.ReduceRows(); var reducedGraph = reducer.ReduceColumns(); var coverer = new Coverer(reducedGraph); var coveredGraph = coverer.CoverRowsAndColumns(); var costFinder = new CostFinder(coveredGraph, _graph); var costs = costFinder.FindZerosToCost(); return(costs); }
public void CoveringShouldGiveCorrectCoveredMatrix() { var graph = new Graph(_dirPathSample + "v1Graph.json"); var correctCoveredGraph = new Graph(_dirPathCorrect + "v1GraphCovered.json"); var reducer = new Reducer(graph); reducer.ReduceRows(); var reducedGraph = reducer.ReduceColumns(); var coverer = new Coverer(reducedGraph); var coveredGraph = coverer.CoverRowsAndColumns(); _output.WriteLine(coveredGraph.ToString()); coveredGraph.AdjacencyMatrix.ShouldBeEquivalentTo(correctCoveredGraph.AdjacencyMatrix); }
public void FindingCostsInUnequivocalGraphShouldGiveCorrectUnequivocalCosts() { var graph = new Graph(_dirPathSample + "v1Graph.json"); var correctCosts = CreateCorrectUnequivocalCostsForGraphV1(); var reducer = new Reducer(graph); reducer.ReduceRows(); var reducedGraph = reducer.ReduceColumns(); var coverer = new Coverer(reducedGraph); var coveredGraph = coverer.CoverRowsAndColumns(); var costFinder = new CostFinder(coveredGraph, graph); var costsList = costFinder.FindZerosToCost(); ShowCosts(costsList); CostsListsAreEqual(costsList, correctCosts).Should().BeTrue(); }