public virtual void TestIsolated_NonCyclic() { int[][] g = new int[][] { new[] { 1 }, new[] { 0, 2 }, new[] { 1, 3 }, new[] { 2, 4 }, new[] { 3 } }; ICyclicVertexSearch search = new JumboCyclicVertexSearch(g); Assert.IsTrue(Compares.AreDeepEqual(Array.Empty <int>(), search.Cyclic())); }
public virtual void TestCyclic() { // cyclohexane like int[][] g = new int[][] { new[] { 5, 1 }, new[] { 0, 2 }, new[] { 1, 3 }, new[] { 2, 4 }, new[] { 3, 5 }, new[] { 4, 0 } }; ICyclicVertexSearch search = new JumboCyclicVertexSearch(g); Assert.IsTrue(Compares.AreDeepEqual(new int[] { 0, 1, 2, 3, 4, 5 }, search.Cyclic())); }
public virtual void TestIsolated_Empty() { ICyclicVertexSearch search = new JumboCyclicVertexSearch(Array.Empty <int[]>()); Assert.IsTrue(Compares.AreDeepEqual(Array.Empty <int>(), search.Cyclic())); Assert.IsTrue(Compares.AreDeepEqual(Array.Empty <int[]>(), search.Isolated())); Assert.IsTrue(Compares.AreDeepEqual(Array.Empty <int[]>(), search.Fused())); }
public virtual void TestCyclic_Int() { // cyclohexane like int[][] g = new int[][] { new[] { 5, 1 }, new[] { 0, 2 }, new[] { 1, 3 }, new[] { 2, 4 }, new[] { 3, 5 }, new[] { 4, 0 } }; ICyclicVertexSearch search = new JumboCyclicVertexSearch(g); for (int v = 0; v < g.Length; v++) { Assert.IsTrue(search.Cyclic(v)); } }
public virtual void TestCyclic_IntInt() { int[][] g = new int[][] { new[] { 5, 1 }, new[] { 0, 2 }, new[] { 1, 3 }, new[] { 2, 4 }, new[] { 3, 5 }, new[] { 4, 0, 6 }, new[] { 5 } }; ICyclicVertexSearch search = new JumboCyclicVertexSearch(g); Assert.IsTrue(search.Cyclic(0, 1)); Assert.IsTrue(search.Cyclic(1, 2)); Assert.IsTrue(search.Cyclic(2, 3)); Assert.IsTrue(search.Cyclic(3, 4)); Assert.IsTrue(search.Cyclic(4, 5)); Assert.IsTrue(search.Cyclic(5, 0)); Assert.IsFalse(search.Cyclic(5, 6)); }
public virtual void TestIsolatedFragments() { // two disconnected cyclohexanes int[][] g = new int[][] { new[] { 5, 1 }, new[] { 0, 2 }, new[] { 1, 3 }, new[] { 2, 4 }, new[] { 3, 5 }, new[] { 4, 0 }, new[] { 11, 7 }, new[] { 6, 8 }, new[] { 7, 9 }, new[] { 8, 10 }, new[] { 9, 11 }, new[] { 10, 7 } }; ICyclicVertexSearch search = new JumboCyclicVertexSearch(g); Assert.IsTrue(Compares.AreDeepEqual(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }, search.Cyclic())); int[][] isolated = search.Isolated(); Assert.AreEqual(2, isolated.Length); Assert.IsTrue(Compares.AreDeepEqual(new int[] { 0, 1, 2, 3, 4, 5 }, isolated[0])); Assert.IsTrue(Compares.AreDeepEqual(new int[] { 6, 7, 8, 9, 10, 11 }, isolated[1])); }
public virtual void TestIsolated_Biphenyl() { // biphenyl like int[][] g = new int[][] { new[] { 5, 1 }, new[] { 0, 2 }, new[] { 1, 3 }, new[] { 2, 4 }, new[] { 3, 5 }, new[] { 4, 0, 6 }, new[] { 11, 7, 5 }, new[] { 6, 8 }, new[] { 7, 9 }, new[] { 8, 10 }, new[] { 9, 11 }, new[] { 10, 7 } }; ICyclicVertexSearch search = new JumboCyclicVertexSearch(g); Assert.IsTrue(Compares.AreDeepEqual(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }, search.Cyclic())); int[][] isolated = search.Isolated(); Assert.IsTrue(Compares.AreDeepEqual(2, isolated.Length)); Assert.IsTrue(Compares.AreDeepEqual(new int[] { 0, 1, 2, 3, 4, 5 }, isolated[0])); Assert.IsTrue(Compares.AreDeepEqual(new int[] { 6, 7, 8, 9, 10, 11 }, isolated[1])); }