Dimensionality
A periodic graph g
of type PeriodicGraph{N}
has dimension N
, which means that its unit cell is repeated across N
independent axes. However, this number may be larger than the actual number of independent axes necessary to describe the repeating unit of the graph, which we will call the dimensionality. For example, consider an infinite set of identical 2-periodic graphs stacked across a third dimension: the resulting graph is of dimension 3, but its dimensionality is 2 (or below) because all the topological information is stored in the 2-periodic subgraph.
The connected components of g
can be separated and sorted by dimensionality using the dimensionality
function:
PeriodicGraphs.dimensionality
— Functiondimensionality(g::PeriodicGraph{N}) where N
Determine the actual dimension of each connected component of g
. Return a dictionary where each entry n => [(l1,m1), (l2,m2), ...]
means that li
is a list of vertices that form a connected component of dimension n
, and that component is present mi
times per unit cell.
In other words, the connected component li
has a periodicity that can only be expressed in a unit cell mi
times larger than the current one.
Examples
julia> dimensionality(PeriodicGraph("2 1 1 1 0 2 2 -1 1 3 3 1 0 3 3 0 1"))
+Dimensionality · PeriodicGraphs.jl Dimensionality
A periodic graph g
of type PeriodicGraph{N}
has dimension N
, which means that its unit cell is repeated across N
independent axes. However, this number may be larger than the actual number of independent axes necessary to describe the repeating unit of the graph, which we will call the dimensionality. For example, consider an infinite set of identical 2-periodic graphs stacked across a third dimension: the resulting graph is of dimension 3, but its dimensionality is 2 (or below) because all the topological information is stored in the 2-periodic subgraph.
The connected components of g
can be separated and sorted by dimensionality using the dimensionality
function:
PeriodicGraphs.dimensionality
— Functiondimensionality(g::PeriodicGraph{N}) where N
Determine the actual dimension of each connected component of g
. Return a dictionary where each entry n => [(l1,m1), (l2,m2), ...]
means that li
is a list of vertices that form a connected component of dimension n
, and that component is present mi
times per unit cell.
In other words, the connected component li
has a periodicity that can only be expressed in a unit cell mi
times larger than the current one. See also split_catenation
.
Examples
julia> dimensionality(PeriodicGraph("2 1 1 1 0 2 2 -1 1 3 3 1 0 3 3 0 1"))
Dict{Int64, Vector{Tuple{Vector{Int64}, Int64}}} with 2 entries:
2 => [([3], 1)]
1 => [([1], 1), ([2], 1)]
julia> dimensionality(PeriodicGraph("1 1 1 2"))
Dict{Int64, Vector{Tuple{Vector{Int64}, Int64}}} with 1 entry:
- 1 => [([1], 2)]
sourceTo transpose a graph from one dimension N
to another D
, call the type constructor PeriodicGraph{D}
directly on g::PeriodicGraph{N}
. This can be useful to manipulate a graph of dimensionality D
as a graph of actual dimension D
, which often reduces computational costs.
PeriodicGraphs.PeriodicGraph
— MethodPeriodicGraph{D}(graph::PeriodicGraph{N}) where {D,N}
Return a graph that has the same structural information as the input graph
but embedded in D
dimensions instead of N
. It will fail if the dimensionality of the graph is greater than D
.
Note The behaviour is undefined if D < N
and there are multiple non-identical connected components. In particular, the function is expected to fail if these components do not share the same orientation.
sourceFor example, the following function extracts the list of 1-dimensional components from a given PeriodicGraph
:
julia> function extract_1D_components(g::PeriodicGraph{D}) where D
+ 1 => [([1], 2)]
sourceSee also split_catenation
to split connected components in a more detailed fashion, when multiple components can share the same vertex indices:
PeriodicGraphs.split_catenation
— Functionsplit_catenation(graph::PeriodicGraph{N}) where N
Return a list of tuples (sublist, mat, dim)
. Each sublist
is made of a list of pairs (subgraph, vmap)
where subgraph
is a connected component of the input graph
, whose vertices are given by vmap
from graph
. dim
is the dimensionality
of these connected components, and mat
is the transformation matrix between the input cell and the component's cell.
Each sublist contains connected components that share the same vertex indices.
Example
julia> g = PeriodicGraph("2 1 1 3 0 1 1 0 1 2 3 1 0 3 2 1 0");
+
+julia> dimensionality(g)
+Dict{Int64, Vector{Tuple{Vector{Int64}, Int64}}} with 2 entries:
+ 2 => [([1], 3)]
+ 1 => [([2, 3], 2)]
+
+julia> splits = split_catenation(g);
+
+julia> last.(splits) # One 2-dimensional catenation (vertex 1), one 1-dimensional (vertices 2 and 3)
+2-element Vector{Int64}:
+ 2
+ 1
+
+julia> sublist, mat, dim = last(splits); # the 1-dimensional connected components
+
+julia> sublist # first sublist takes vertex 2 from the reference unit cell, second one takes vertex 3.
+2-element Vector{Tuple{PeriodicGraph2D, Vector{PeriodicVertex2D}}}:
+ (PeriodicGraph2D(2, PeriodicEdge2D[(1, 2, (0,0)), (1, 2, (1,0))]), [(2, (0,0)), (3, (-1,0))])
+ (PeriodicGraph2D(2, PeriodicEdge2D[(1, 2, (0,0)), (1, 2, (1,0))]), [(3, (0,0)), (2, (-1,0))])
sourceTo transpose a graph from one dimension N
to another D
, call the type constructor PeriodicGraph{D}
directly on g::PeriodicGraph{N}
. This can be useful to manipulate a graph of dimensionality D
as a graph of actual dimension D
, which often reduces computational costs.
PeriodicGraphs.PeriodicGraph
— MethodPeriodicGraph{D}(graph::PeriodicGraph{N}) where {D,N}
Return a graph that has the same structural information as the input graph
but embedded in D
dimensions instead of N
. It will fail if the dimensionality of the graph is greater than D
.
Note The behaviour is undefined if D < N
and there are multiple non-identical connected components. In particular, the function is expected to fail if these components do not share the same orientation.
sourceFor example, the following function extracts the list of 1-dimensional components from a given PeriodicGraph
:
julia> function extract_1D_components(g::PeriodicGraph{D}) where D
d = dimensionality(g)
components1D = get(d, 1, Vector{Int}[])
return [PeriodicGraph1D(g[l]) for l in components1D]
@@ -21,4 +40,4 @@
julia> extract_1D_components(g)
2-element Vector{PeriodicGraph1D}:
PeriodicGraph1D(1, PeriodicEdge1D[(1, 1, (1,))])
- PeriodicGraph1D(2, PeriodicEdge1D[(1, 2, (-1,)), (1, 2, (1,))])
The first subgraph corresponds to g[[3]]
and the second to g[[6,7]]
, both converted to PeriodicGraph1D
.
The dimension of a graph can also be reduced with loss of information through the slice_graph
function.
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 7 June 2024. Using Julia version 1.6.7.
The first subgraph corresponds to g[[3]]
and the second to g[[6,7]]
, both converted to PeriodicGraph1D
.
The dimension of a graph can also be reduced with loss of information through the slice_graph
function.