A collection of algorithms for cycles in a graph.
Project description
cycless
A collection of algorithms to analyze a graph as a set of cycles.
Some codes come from https://github.com/vitroid/Polyhed and https://github.com/vitroid/countrings are integrated and improved.
cycles.py
A simple algorithm to enumerate all irreducible cycles of n-members and smaller in an undirected graph. [Matsumoto 2007]
import cycless.cycles as cy
import networkx as nx
g = nx.cubical_graph()
for cycle in cy.cycles_iter(g, maxsize=6):
print(cycle)
dicycles.py
An algorithm to enumerate the directed cycles of a size in a dircted graph. [Matsumoto 2021]
from genice2.genice import GenIce
from genice2.plugin import Lattice, Format, Molecule
import cycless.dicycles as dc
# Generate an ice I structure as a directed graph
lattice = Lattice("1h")
formatter = Format("raw", stage=(3,))
raw = GenIce(lattice, signature="ice 1h", rep=[2,2,2]).generate_ice(formatter)
for cycle in dc.dicycles_iter(raw['digraph'], size=6):
print(cycle)
polyhed.py
An algorithm to enumerate the quasi-polyhedral hull made of cycles in an undirected graph. A quasi-polyhedral hull (vitrite) obeys the following conditions: [Matsumoto 2007]
- The surface of the hull is made of irreducible cycles.
- Two or three cycles shares a vertex of the hull.
- Two cycles shares an edge of the hull.
- Its Euler index (F-E+V) is two.
import cycless.cycles as cy
import cycless.polyhed as ph
import networkx as nx
g = nx.dodecahedral_graph()
cycles = [cycle for cycle in cy.cycles_iter(g, maxsize=6)]
for polyhed in ph.polyhedra_iter(cycles):
print(polyhed)
simplex.py
Enumerate triangle, tetrahedral, and octahedral subgraphs found in the given graph.
References
- M. Matsumoto, A. Baba, and I. Ohmine, Topological building blocks of hydrogen bond network in water, J. Chem. Phys. 127, 134504 (2007). http://doi.org/10.1063/1.2772627
- Matsumoto, M., Yagasaki, T. & Tanaka, H. On the anomalous homogeneity of hydrogen-disordered ice and its origin. J. Chem. Phys. 155, 164502 (2021). https://doi.org/10.1063/5.0065215
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cycless-0.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df966d8a35ac6d264d5b35bcf0b81336b92ca9f94a185856e8e2e24358954cae |
|
MD5 | 892569c60fd20a4e3c2dbac0a64dc077 |
|
BLAKE2b-256 | ff85ddbad1034b362aef1574229aa43deeae03ad786dfb1d8f79cd33c2166d42 |