public void Circle4HasTwoEdgesInMatching()
        {
            var mm       = new MaximalMatching(GraphHelper.Circle4());
            var matching = mm.Find();

            Assert.Equal(2, matching.Count());
        }
        public void MatchingIsTheSameAsWhatFindReturns()
        {
            var mm       = new MaximalMatching(GraphHelper.Circle4());
            var matching = mm.Find();

            Assert.Equal(matching, mm.Matching);
        }
        public void AfterFindMatchingIsPopulated()
        {
            var mm = new MaximalMatching(new List <INode>());

            mm.Find();
            Assert.NotNull(mm.Matching);
        }
        public void FindingMaximalMatchingInOtherGraphShouldReturnCorrectMatchedGraph()
        {
            var correctMaximalMatchedGraph = new Graph(_dirPathCorrect + "v2GraphMaximalMatched.json");
            var graph = new Graph(_dirPathSample + "v2Graph.json");

            var maximalMatching     = new MaximalMatching(graph);
            var maximalMatchedGraph = maximalMatching.FindMaximalMatchedGraph();

            _output.WriteLine(maximalMatchedGraph.ToString());
            maximalMatchedGraph.AdjacencyMatrix.Should().BeEquivalentTo(correctMaximalMatchedGraph.AdjacencyMatrix);
        }
        public void TreeGraphDoesNotGetStuckInALoop()
        {
            INode root  = EntityHelper.CreateNode();
            INode leaf1 = EntityHelper.CreateNode();
            INode leaf2 = EntityHelper.CreateNode();

            root.ConnectTo(leaf1, EdgeDirection.Both);
            root.ConnectTo(leaf2, EdgeDirection.Both);

            var mm       = new MaximalMatching(new[] { root, leaf1, leaf2 });
            var matching = mm.Find();

            Assert.Equal(1, matching.Count());
        }
        public void EmptyInputListProducesEmptyMatching()
        {
            var mm = new MaximalMatching(new List <INode>());

            Assert.Empty(mm.Find());
        }