Example #1
0
        public void TwoDifferentGraphsAsConnectedCliquesUnfortunateVertices()
        {
            #region Give
            var g1Name           = "b1";
            var g1ExpectedResult = new int[] { 4, 5, 6 };
            var g2Name           = "b2_unfortunate_numerating";
            var g2ExpectedResult = new int[] { 2, 5, 4 };

            var g1Path = Environment.CurrentDirectory + "\\..\\..\\..\\Graphs\\" + g1Name + ".csv";
            var g2Path = Environment.CurrentDirectory + "\\..\\..\\..\\Graphs\\" + g2Name + ".csv";

            var alg = new LinkingCliquesAlgorithm();
            #endregion

            #region When
            int[] x1;
            int[] x2;
            (x1, x2) = alg.GetMaximalCommonSubgraphMapping(g1Path, g2Path);
            #endregion

            #region Then
            Assert.Equal(x1.Length, x2.Length);
            for (int i = 0; i < x1.Length; i++)
            {
                Assert.Equal(g1ExpectedResult[i], x1[i]);
                Assert.Equal(g2ExpectedResult[i], x2[i]);
            }
            #endregion
        }
Example #2
0
        public void SameCliquesConnectedWithBridge()
        {
            #region Give
            var gName           = "b6_k3_bridge_k3";
            var gExpectedResult = new int[] { 1, 0, 2, 3, 4, 5, 6 };

            var gPath = Environment.CurrentDirectory + "\\..\\..\\..\\Graphs\\" + gName + ".csv";

            var alg = new LinkingCliquesAlgorithm();
            #endregion

            #region When
            int[] x1;
            int[] x2;
            (x1, x2) = alg.GetMaximalCommonSubgraphMapping(gPath, gPath);
            #endregion

            #region Then
            Assert.Equal(gExpectedResult.Length, x1.Length);
            Assert.Equal(gExpectedResult.Length, x2.Length);

            for (int i = 0; i < gExpectedResult.Length; i++)
            {
                Assert.Equal(gExpectedResult[i], x1[i]);
                Assert.Equal(gExpectedResult[i], x2[i]);
            }

            #endregion
        }
Example #3
0
        public void A1A2()
        {
            #region Give
            var g1Name = "a1";
            var g2Name = "a2";

            var gExpectedResult = new int[] { 0 };

            var g1Path = Environment.CurrentDirectory + "\\..\\..\\..\\Graphs\\" + g1Name + ".csv";
            var g2Path = Environment.CurrentDirectory + "\\..\\..\\..\\Graphs\\" + g2Name + ".csv";

            var alg = new LinkingCliquesAlgorithm();
            #endregion

            #region When
            int[] x1;
            int[] x2;
            (x1, x2) = alg.GetMaximalCommonSubgraphMapping(g1Path, g2Path);
            #endregion

            #region Then
            Assert.Equal(gExpectedResult.Length, x1.Length);
            Assert.Equal(gExpectedResult.Length, x2.Length);

            for (int i = 0; i < gExpectedResult.Length; i++)
            {
                Assert.Equal(gExpectedResult[i], x1[i]);
                Assert.Equal(gExpectedResult[i], x2[i]);
            }

            #endregion
        }
Example #4
0
        public void TwoSameGraphsAsConnectedCliques(string name)
        {
            #region Give
            var gPath = Environment.CurrentDirectory + "\\..\\..\\..\\Graphs\\" + name + ".csv";

            var alg = new LinkingCliquesAlgorithm();
            var g   = new Graph();
            g.FillEdgesFromCsv(gPath);
            #endregion

            #region When
            int[] x1;
            int[] x2;
            (x1, x2) = alg.GetMaximalCommonSubgraphMapping(gPath, gPath);
            #endregion

            #region Then

            #endregion
        }
Example #5
0
        public void TwoDifferentGraphsAsConnectedCliquesWithoutCommonCliques()
        {
            #region Give
            var g1Name = "b4_k3_with_k1";
            var g2Name = "b5_k4_with_k2";

            var g1Path = Environment.CurrentDirectory + "\\..\\..\\..\\Graphs\\" + g1Name + ".csv";
            var g2Path = Environment.CurrentDirectory + "\\..\\..\\..\\Graphs\\" + g2Name + ".csv";

            var alg = new LinkingCliquesAlgorithm();
            #endregion

            #region When
            int[] x1;
            int[] x2;
            (x1, x2) = alg.GetMaximalCommonSubgraphMapping(g1Path, g2Path);
            #endregion

            #region Then
            Assert.Empty(x1);
            Assert.Empty(x2);
            #endregion
        }