{"id":21156346,"url":"https://github.com/vitroid/countrings","last_synced_at":"2025-07-09T12:32:26.095Z","repository":{"id":10882685,"uuid":"13172350","full_name":"vitroid/CountRings","owner":"vitroid","description":"Count rings in a undirected graph.","archived":false,"fork":false,"pushed_at":"2023-05-06T16:25:43.000Z","size":68,"stargazers_count":14,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-11-20T16:02:23.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"DelvarWorld/some-game","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitroid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-28T12:17:59.000Z","updated_at":"2023-10-04T14:39:51.000Z","dependencies_parsed_at":"2022-09-14T11:01:31.945Z","dependency_job_id":null,"html_url":"https://github.com/vitroid/CountRings","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitroid%2FCountRings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitroid%2FCountRings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitroid%2FCountRings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitroid%2FCountRings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitroid","download_url":"https://codeload.github.com/vitroid/CountRings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225542433,"owners_count":17485879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T11:43:02.849Z","updated_at":"2024-11-20T11:43:03.422Z","avatar_url":"https://github.com/vitroid.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ring Statistics Algorithm\n\n## NOTE\n\nThe codes are refactored and now included in another repository: [Cycless](https://github.com/vitroid/cycless)\n\nYou can utilize the algorithm in a simpler way:\n```python\nimport cycless.cycles as cy\nimport networkx as nx\n\ng = nx.cubical_graph()\n\nfor cycle in cy.cycles_iter(g, maxsize=6):\n    print(cycle)\n```\n\n## Counting policy\n\n* It counts only irreducible rings (rings not having shortcut bridges).\n* It counts rings purely topologically. It does not use geometrical information.\n* Edge direction is not considered. (Undirected graph)\n\n## Algorithm\n\n1. Choose 3 successive nodes (i.e. two adjacent acyclic edges) along the network. (King's criteria) [King1991]\n1. Find the smallest rings passing the three nodes.\n1. The ring must not have shotcuts, i.e. path connecting two vertices on the ring which is shorter than the path along the ring. (Using Dijkstra's algorithm.) (Franzblau's SP ring criteria) [Franzblau1991]\n1. Put the ring in the list.\n1. Repeat 1 .. 4 until all sets of 3 successive nodes are tested.\n1. Eliminate the permutations of a ring in the list.\n1. (Optional) Remove \"crossing rings\".\n\nSo, our definition is a hybrid of the algorithms of King and Franzblau.\n\n### Note\n\n* Our definition is different from Franzblau's SP ring. Our algorithm does not count the 6-membered rings in a cubic graph but counts the geodesic 4-membered rings in a regular octahedral graph. [Franzblau1991]\n* Our definition is different from King's K ring. [King1991]\n* Our definition is different from Goetzke's strong ring. We do not care the strength. [Goetzke1991]\n* Our definition is different from that of Camisasca's. They count too much 5-membered rings. [Camisasca2019]\n* Probably somebody has already made the same definition. Let me know if you find that.\n\n## Usage\n\n    usage: countrings [-h] [--count] [--debug] [--quiet] [maxsize]\n    \n    positional arguments:\n      maxsize      Maximum size of the ringd\n    \n    optional arguments:\n      -h, --help   show this help message and exit\n      --count, -c  Only output the ring statistics.\n      --debug, -D  Output debugging info.\n      --quiet, -q  Do not output progress messages.\n\n\nInput data must be in \u003ca href=\"http://theochem.chem.okayama-u.ac.jp/wiki/wiki.cgi/matto?page=%40NGPH\"\u003e@NGPH\u003c/a\u003e format. Output data will be in \u003ca href=\"http://theochem.chem.okayama-u.ac.jp/wiki/wiki.cgi/matto?page=%40RNGS\"\u003e@RNGS\u003c/a\u003e format.\n\n    % ./countrings.py 8 \u003c test.ngph \u003e test.rngs\n    % ./countrings.py 8 \u003c test.ngph | ./crossingrings.pl \u003e test2.rngs\n\n## Sample\n\nThe following is the expression of a cubic graph, which should have six 4-cycles.\n\n    @NGPH\n    8\n    0 1\n    1 2\n    2 3\n    3 0\n    4 5\n    5 6\n    6 7\n    7 4\n    0 4\n    1 5\n    2 6\n    3 7\n    -1 -1\n\nYou can pick up many samples at the Vitrite database:\n    http://reg.chem.okayama-u.ac.jp/cgi-bin/vitrite.cgi\n\n## Known Problems\n\n### Sample 1\n\n\u003cimg src=\"imgs/sample1.png\" /\u003e\u003cbr /\u003e\nNumber of rings in this kind of graph consisting of N bows is counted as N (N-1) / 2. It happens because of the lack of 3-dimentional geometrical information.\n\n### Sample 2\n\n\u003cimg src=\"imgs/sample2.png\" /\u003e\u003cbr /\u003e\n It is a smaller version of sample 1 consisting of 4 bows. As you see, surface rings of this structure seems to be 4, while the algorithm counts as 6, because it also counts the “crossing rings” (diagonal red and blue rings). These sample topologies rarely appear in the network of water at low temperature because the z-index at the top and bottom nodes is too large. \nWhile, there is another sample containing crossing rings but still undistorted.\n\n### Sample 3\n\n\u003cimg src=\"imgs/sample3.png\" /\u003e\n\n## Wayarounds\n\nThe small Perl program “crossingrings.pl” looks up all the crossing rings in the ring list (in \u003ca href=\"http://theochem.chem.okayama-u.ac.jp/wiki/wiki.cgi/matto?page=%40RNGS\"\u003e@RNGS\u003c/a\u003e format) and remove one of them randomly until the crossing is avoided. With the use of 3-dimentional geometrical information, there might be better walkarounds.\n\n## Note\n\nThis program is developed for analysing the hydrogen bond network of water.\nAn affordable and relevant definition of the hydogen bonds is discussed \u003ca href=\"http://theochem.chem.okayama-u.ac.jp/wiki/wiki.cgi/matto?page=Relevance+of+Hydrogen+Bond+Definition\"\u003ehere\u003c/a\u003e.\n\n## To Cite It\n\n* M. Matsumoto, A. Baba, and I. Ohmine, Topological building blocks of hydrogen bond network in water, J. Chem. Phys. 127, 134504 (2007); [doi:10.1063/1.2772627](http://dx.doi.org/doi:10.1063/1.2772627)\n\n## References\n\n* Camisasca, G., Schlesinger, D., Zhovtobriukh, I., Pitsevich, G. \u0026 Pettersson, L. G. M. A proposal for the structure of high- and low-density fluctuations in liquid water. J. Chem. Phys. 151, 034508 (2019).\n* Downs, G. M., Gillet, V. J., Holliday, J. D. \u0026 Lynch, M. F. Review of ring perception algorithms for chemical graphs. J. Chem. Inf. Comput. Sci. 29, 172–187 (1989).\n* Franzblau, D. S. Computation of ring statistics for network models of solids. Phys. Rev. B 44, 4925–4930 (1991).\n* Goetzke, K. \u0026 Klein, H. J. Properties and efficient algorithmic determination of different classes of rings in finite and infinite polyhedral networks. J. Non-Cryst. Solids. 127, 215–220 (1991).\n* KING, S. V. Ring Configurations in a Random Network Model of Vitreous Silica. Nature 213, 1112–1113 (1967).\n* Marians, C. S. \u0026 Hobbs, L. W. Network properties of crystalline polymorphs of silica. J. Non-Cryst. Solids. 124, 242–253 (1990).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitroid%2Fcountrings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitroid%2Fcountrings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitroid%2Fcountrings/lists"}