| Copyright | Thodoris Papakonstantinou 2017-2026 |
|---|---|
| License | LGPL-3 |
| Maintainer | dev@tpapak.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.Graph.AdjacencyList.Grid
Description
Generators for d-dimensional cubic lattices with periodic boundary conditions
(toroidal topology). A PBCSquareLattice L D is the Cartesian product of
D cycle graphs of length L: \( C_L \square^D \).
Provides both directed (graphCubicPBC, forward edges only) and undirected
(undirectedGraphCubicPBC, forward + backward edges) variants, plus coordinate
conversion between flat vertex IDs and Cartesian coordinates.
Synopsis
- type L = Natural
- type D = Natural
- type CVertex = [Vertex]
- fromTuple :: (Vertex, Vertex) -> Edge
- toTuple :: Edge -> (Vertex, Vertex)
- adjacentEdges :: Graph -> Vertex -> [Edge]
- vertexToCVertex :: L -> D -> Vertex -> CVertex
- cVertexToVertex :: L -> D -> CVertex -> Vertex
- data PBCSquareLattice = PBCSquareLattice L D
- pbcEdgeIx :: L -> D -> Edge -> Maybe Int
- gridSize :: PBCSquareLattice -> Natural
- gridNumEdges :: PBCSquareLattice -> Natural
- pbcForwardEdges :: L -> D -> Vertex -> [Edge]
- pbcBackwardEdges :: L -> D -> Vertex -> [Edge]
- undirectedGraphCubicPBC :: PBCSquareLattice -> Graph
- graphCubicPBC :: PBCSquareLattice -> Graph
Documentation
type CVertex = [Vertex] Source #
Cartesian coordinates of a lattice vertex: a list of per-dimension indices.
vertexToCVertex :: L -> D -> Vertex -> CVertex Source #
Given a Vertex returns a tuple of the Cartesian product of a L sized Cycle graph
data PBCSquareLattice Source #
A PBCSquareLattice is the Cartesian product of a cycle graph of length L (C_L) => (C_L)▢^d
Constructors
| PBCSquareLattice L D |
Instances
| Show PBCSquareLattice Source # | |
Defined in Data.Graph.AdjacencyList.Grid Methods showsPrec :: Int -> PBCSquareLattice -> ShowS # show :: PBCSquareLattice -> String # showList :: [PBCSquareLattice] -> ShowS # | |
| Eq PBCSquareLattice Source # | |
Defined in Data.Graph.AdjacencyList.Grid Methods (==) :: PBCSquareLattice -> PBCSquareLattice -> Bool # (/=) :: PBCSquareLattice -> PBCSquareLattice -> Bool # | |
pbcEdgeIx :: L -> D -> Edge -> Maybe Int Source #
Index of edge of a grid with periodic boundary conditions Very inefficient, better use Data.Map for lookups.
gridSize :: PBCSquareLattice -> Natural Source #
Total number of vertices in the lattice: L^D.
gridNumEdges :: PBCSquareLattice -> Natural Source #
Number of directed (forward) edges in the lattice: D * L^D.
pbcForwardEdges :: L -> D -> Vertex -> [Edge] Source #
Returns tuple (edge) giving forward vertices of given vertex on a Toroidal Boundary Conditions (pbc) grid
pbcBackwardEdges :: L -> D -> Vertex -> [Edge] Source #
Returns tuple (edge) giving backward vertices of given vertex on a Toroidal Boundary Conditions (pbc) grid
Undirected cubic graph with PBC
undirectedGraphCubicPBC :: PBCSquareLattice -> Graph Source #
Undirected graph on a PBC cubic lattice (both forward and backward edges).
Contains 2 * D * L^D directed edges (two per neighbor pair).
Directed cubic graph with PBC
graphCubicPBC :: PBCSquareLattice -> Graph Source #
Directed graph embeded in cubic lattice