public void Benzylbenzene() { Graph g = Graph.FromSmiles("c1ccccc1Cc1ccccc1"); BiconnectedComponents bc = new BiconnectedComponents(g, false); Assert.AreEqual(12, BitArrays.Cardinality(bc.Cyclic)); }
public void Exocyclic() { Graph g = Graph.FromSmiles("[AsH]=C1C=CC=CC=C1"); BiconnectedComponents bc = new BiconnectedComponents(g); Assert.AreEqual(bc.Components.Count, 1); Assert.AreEqual(bc.Components[0].Count, 7); }
public void Bridged() { Graph g = Graph.FromSmiles("C1CC2CCC1C2"); BiconnectedComponents bc = new BiconnectedComponents(g); Assert.AreEqual(bc.Components.Count, 1); Assert.AreEqual(bc.Components[0].Count, 8); }
public void Fused() { Graph g = Graph.FromSmiles("C1=CC2=CC=CC=C2C=C1"); BiconnectedComponents bc = new BiconnectedComponents(g); Assert.AreEqual(bc.Components.Count, 1); Assert.AreEqual(bc.Components[0].Count, 11); }
public void Benzene() { Graph g = Graph.FromSmiles("c1ccccc1"); BiconnectedComponents bc = new BiconnectedComponents(g); Assert.AreEqual(bc.Components.Count, 1); Assert.AreEqual(bc.Components[0].Count, 6); }
public void Spiro() { Graph g = Graph.FromSmiles("C1CCCCC11CCCCC1"); BiconnectedComponents bc = new BiconnectedComponents(g); Assert.AreEqual(bc.Components.Count, 2); Assert.AreEqual(bc.Components[0].Count, 6); Assert.AreEqual(bc.Components[0].Count, 6); }
public AllCycles(Graph g, ElectronDonation model, int lim) { this.org = g; this.ps = new int[g.Order]; this.pathGraph = new IList <PathEdge> [g.Order]; this.aromatic = new bool[g.Order]; ElectronDonation.ICycle cycle = new Inner_ElectronDonation_Cycle(); BitArray cyclic = new BiconnectedComponents(g).Cyclic; for (int u = 0; u < g.Order; u++) { ps[u] = model.Contribution(u, g, cycle, cyclic); } for (int u = 0; u < g.Order; u++) { this.pathGraph[u] = new List <PathEdge>(); } // build the path graph foreach (var e in g.Edges) { int u = e.Either(); int v = e.Other(u); if (cyclic[u] && cyclic[v] && ps[u] >= 0 && ps[v] >= 0) { PathEdge f = new PathEdge(u, v, new BitArray(g.Order), 0); Add(u, v, f); } } for (int u = 0; u < g.Order; u++) { if (this.pathGraph[u].Count > MAX_VERTEX_DEGREE) { throw new ArgumentException("too many cycles generated: " + pathGraph[u].Count); } Reduce(u, lim); } }