Skip to main content

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.

API

API manual is here.

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]

  1. The surface of the hull is made of irreducible cycles.
  2. Two or three cycles shares a vertex of the hull.
  3. Two cycles shares an edge of the hull.
  4. 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

  1. 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
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cycless-0.4.3.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cycless-0.4.3-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file cycless-0.4.3.tar.gz.

File metadata

  • Download URL: cycless-0.4.3.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.4 Darwin/24.1.0

File hashes

Hashes for cycless-0.4.3.tar.gz
Algorithm Hash digest
SHA256 03fbc474a3e2ed5014d757c3610c5f028acae2328e4f6bba5ca110dc5f8eb24d
MD5 c7b3cbd4c0b7879bd03b579fdbb0b8aa
BLAKE2b-256 3f65f8dddace3ba9d0412ca479beb66c815178bc4e0b3216522088366d19e20c

See more details on using hashes here.

File details

Details for the file cycless-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: cycless-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.4 Darwin/24.1.0

File hashes

Hashes for cycless-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bb5b4c17a27ecc47eb1c057c2cf1f62f0da67d23732323691eb42cc6c04a42ad
MD5 58497697b4790b854e1ca1487da840d6
BLAKE2b-256 4454510d5d3d606a1a7103cae89913912be41ab94eddec3fa259610b7526ed47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page