QInchworm.diagrammatics
QInchworm.diagrammatics
— ModuleStrong coupling expansion diagrams and their topological properties.
QInchworm.diagrammatics.Topology
— Typestruct Topology
Datatype for strong coupling diagram topology.
A topology of order $n$ consists of a partition of the tuple $s = \{1,...,2n\}$ into $n$ pairs $\{(\pi(1), \pi(2)), ..., (\pi(2n-1), \pi(2n))\}$ where $\pi$ is a permutation of $s$. Diagrammatically, a topology can be thought of as a set of arcs connecting vertices located at $\{1,...,2n\}$. The parity of the topology is the sign of the permutation $\pi$.
Fields
order::Int64
: Topology order $n$pairs::Vector{Pair{Int64, Int64}}
: List of pairs $\{(\pi(1), \pi(2)), ..., (\pi(2n-1), \pi(2n))\}$parity::Int64
: Parity of the permutation $\pi$
QInchworm.diagrammatics.Topology
— MethodTopology(
pairs::Vector{Pair{Int64, Int64}}
) -> QInchworm.diagrammatics.Topology
Construct topology from a list of pairs.
QInchworm.diagrammatics.parity
— Functionparity(top::QInchworm.diagrammatics.Topology) -> Int64
Returns the parity of the topolgy.
Base.isvalid
— Methodisvalid(t::QInchworm.diagrammatics.Topology) -> Bool
Check that topology is properly constructed, i.e. that its list of pairs is derived from a permutation of 1:2order
and that the parity of the permutation is correct.
QInchworm.diagrammatics.sortpair
— Functionsortpair(p::Pair{T, T}) -> Pair
Given a pair, return its version with the smallest element coming first.
QInchworm.diagrammatics.pop_pair
— Functionpop_pair(v::Vector, i, j) -> Tuple{Pair, Vector}
Return the pair v[i] => v[j]
and a copy of the vector v
with elements i
, j
removed.
QInchworm.diagrammatics.pair_partitions
— Functionpair_partitions(
pairs::Vector{Pair{Int64, Int64}},
unpaired::Vector{Int64}
) -> Vector{Vector{Pair{Int64, Int64}}}
Given a vector of pairs representing a partial partition of the vertices and a vector of unpaired vertices, return a vector of complete partitions.
pair_partitions(
vertices::Vector{Int64}
) -> Vector{Vector{Pair{Int64, Int64}}}
Return all possible partitions of an even number of vertices into pairs.
pair_partitions(
n::Int64
) -> Vector{Vector{Pair{Int64, Int64}}}
Return all partitions of $\{1,\ldots,2n\}$ into $n$ pairs.
QInchworm.diagrammatics.iscrossing
— Functioniscrossing(
p1::Pair{Int64, Int64},
p2::Pair{Int64, Int64}
) -> Bool
Return true
if two arcs cross.
Let $p_1 = (a_1, b_1)$, $p_2 = (a_2, b_2)$ represent two arcs, where without loss of generality we assume $a_1 < b_1$ and $a_2 < b_2$. Now consider the order of the points $\{a_1, b_1, a_2, b_2\}$. The orderings $a_1 b_1 a_2 b_2$, $a_1 a_2 b_2 b_1$, $a_2 b_2 a_1 b_1$ are all non-crossing while $a_1 a_2 b_1 b_2$ and $a_2 a_1 b_2 b_1$ are crossing.
QInchworm.diagrammatics.n_crossings
— Functionn_crossings(top::QInchworm.diagrammatics.Topology) -> Int64
Return the number of crossing arcs in a topology.
QInchworm.diagrammatics.traverse_crossing_graph_dfs!
— Functiontraverse_crossing_graph_dfs!(
connected::Vector{Pair{Int64, Int64}},
disconnected::Vector{Pair{Int64, Int64}}
)
Given a vector of connected
arcs and a vector of disconnected
arcs recursively add disconnected to connected if they cross with any connected. This is done by traversing the crossing graph using depth first search.
QInchworm.diagrammatics.is_k_connected
— Functionis_k_connected(
t::QInchworm.diagrammatics.Topology,
k::Int64
) -> Bool
Given a topology, check if every connected component of the graph induced by crossings between the arcs contains a pair with an element <= k
.
QInchworm.diagrammatics.split_k_connected
— Functionsplit_k_connected(
pairs::Vector{Pair{Int64, Int64}},
k::Int64
) -> Tuple{Vector{Pair{Int64, Int64}}, Vector{Pair{Int64, Int64}}}
Given a vector of integer pairs, split it into a connected
set containing pairs with an element <= k
and a disconnected set containing the rest.
QInchworm.diagrammatics.is_doubly_k_connected
— Functionis_doubly_k_connected(
p::Pair{Int64, Int64},
k::Int64
) -> Bool
Return true if a given integer pair has one element <= k
and the other element > k
.
is_doubly_k_connected(
t::QInchworm.diagrammatics.Topology,
k::Int64
) -> Bool
Given a topology, check if every connected component of the graph induced by crossings between the arcs contains a pair with one element <= k
and the other element > k
.
QInchworm.diagrammatics.count_doubly_k_connected
— Functioncount_doubly_k_connected(
pairs::Vector{Pair{Int64, Int64}},
k::Int64
) -> Int64
Given a vector of integer pairs, count the doubly k
-connected ones.
QInchworm.diagrammatics.split_doubly_k_connected
— Functionsplit_doubly_k_connected(
pairs::Vector{Pair{Int64, Int64}},
k::Int64
) -> Tuple{Vector{Pair{Int64, Int64}}, Vector{Pair{Int64, Int64}}}
Given a vector of integer pairs, split it into a connected
set containing pairs with one element <= k
and the other element > k
, and a disconnected set containing the rest.
QInchworm.diagrammatics.generate_topologies
— Functiongenerate_topologies(
n::Int64
) -> Vector{QInchworm.diagrammatics.Topology}
Return topologies of order $n$, efficiently computing the permutation sign for each.
QInchworm.diagrammatics.generate_topologies_impl
— Functiongenerate_topologies_impl(
topology_partial::QInchworm.diagrammatics.Topology,
unpaired::Vector{Int64}
) -> Vector{QInchworm.diagrammatics.Topology}
Given a partial topology and a vector of unpaired vertices, return a vector of complete topologies, efficiently computing the permutation sign.
QInchworm.diagrammatics.get_topologies_at_order
— Functionget_topologies_at_order(
order::Int64;
...
) -> Vector{QInchworm.diagrammatics.Topology}
get_topologies_at_order(
order::Int64,
k;
with_external_arc
) -> Vector{QInchworm.diagrammatics.Topology}
Return topologies of a given order. If k
is specified, then only the doubly k-connected topologies are returned. With with_external_arc
set to true
parity of the returned topologies is computed as if an extra arc overarching the last 2order - k
vertices was present.