/// <inheritdoc/> public override int[][] Apply(int[][] graph, int length) { int threshold = 684; // see. AllRingsFinder.Threshold.Pubchem_99 AllCycles ac = new AllCycles(graph, Math.Min(length, graph.Length), threshold); return(ac.Completed ? ac.GetPaths() : VertexShort.Apply(graph, length)); }
/// <summary> /// Find rings in a biconnected component. /// </summary> /// <param name="g">adjacency list</param> /// <param name="length"></param> /// <returns></returns> /// <exception cref="IntractableException">computation was not feasible</exception> private int[][] FindInFused(int[][] g, int length) { AllCycles allCycles = new AllCycles(g, Math.Min(g.Length, length), threshold); if (!allCycles.Completed) { throw new IntractableException("A large number of cycles were being generated and the" + " computation was aborted. Please us AllCycles/AllRingsFinder with" + " and specify a larger threshold or an alternative cycle set."); } return(allCycles.GetPaths()); }
/// <inheritdoc/> public override int[][] Apply(int[][] graph, int length) { int threshold = 684; // see. AllRingsFinder.Threshold.Pubchem_99 AllCycles ac = new AllCycles(graph, Math.Min(length, graph.Length), threshold); if (!ac.Completed) { throw new IntractableException("A large number of cycles were being generated and the" + " computation was aborted. Please use AllCycles/AllRingsFinder with" + " and specify a larger threshold or use a " + nameof(ICycleFinder) + " with a fall-back" + " to a set unique cycles: e.g. " + nameof(Cycles) + "." + nameof(Cycles.AllOrVertexShortFinder) + "."); } return(ac.GetPaths()); }
public virtual void K5Paths() { AllCycles ac = new AllCycles(RegularPathGraphTest.CompleteGraphOfSize(5), 5, 1000); Assert.IsTrue(Compares.AreDeepEqual( new int[][] { new[] { 2, 1, 0, 2 }, new[] { 3, 1, 0, 3 }, new[] { 4, 1, 0, 4 }, new[] { 3, 2, 0, 3 }, new[] { 3, 2, 1, 3 }, new[] { 3, 2, 1, 0, 3 }, new[] { 3, 2, 0, 1, 3 }, new[] { 4, 2, 0, 4 }, new[] { 4, 2, 1, 4 }, new[] { 4, 2, 1, 0, 4 }, new[] { 4, 2, 0, 1, 4 }, new[] { 3, 0, 2, 1, 3 }, new[] { 4, 0, 2, 1, 4 }, new[] { 4, 3, 0, 4 }, new[] { 4, 3, 1, 4 }, new[] { 4, 3, 1, 0, 4 }, new[] { 4, 3, 0, 1, 4 }, new[] { 4, 3, 2, 4 }, new[] { 4, 3, 2, 0, 4 }, new[] { 4, 3, 2, 1, 4 }, new[] { 4, 3, 2, 1, 0, 4 }, new[] { 4, 3, 2, 0, 1, 4 }, new[] { 4, 3, 0, 2, 4 }, new[] { 4, 3, 1, 2, 4 }, new[] { 4, 3, 0, 1, 2, 4 }, new[] { 4, 3, 1, 0, 2, 4 }, new[] { 4, 3, 0, 2, 1, 4 }, new[] { 4, 3, 1, 2, 0, 4 }, new[] { 4, 0, 3, 1, 4 }, new[] { 4, 0, 3, 2, 4 }, new[] { 4, 0, 3, 2, 1, 4 }, new[] { 4, 0, 3, 1, 2, 4 }, new[] { 4, 1, 3, 2, 4 }, new[] { 4, 1, 3, 2, 0, 4 }, new[] { 4, 1, 3, 0, 2, 4 }, new[] { 4, 0, 1, 3, 2, 4 }, new[] { 4, 1, 0, 3, 2, 4 } }, ac.GetPaths())); }
public static void Main(string[] args) { // convert the molecule to adjacency list - may be redundant in future IAtomContainer m = TestMoleculeFactory.MakeAlphaPinene(); int[][] g = GraphUtil.ToAdjList(m); // efficient computation/partitioning of the ring systems RingSearch rs = new RingSearch(m, g); // isolated cycles don't need to be run rs.Isolated(); // process fused systems separately foreach (var fused in rs.Fused()) { const int maxDegree = 100; // given the fused subgraph, max cycle size is // the number of vertices AllCycles ac = new AllCycles(GraphUtil.Subgraph(g, fused), fused.Length, maxDegree); // cyclic walks int[][] paths = ac.GetPaths(); } }