Skip to content

Commit ddf5819

Browse files
committed
update docs
1 parent dd62374 commit ddf5819

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

src/networks.jl

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,40 @@ end
170170
Matching{CT<:EinTypes} <: GraphProblem
171171
Matching(graph; openvertices=(), optimizer=GreedyMethod(), simplifier=nothing)
172172
173-
Vertex matching problem.
173+
[Vertex matching](https://mathworld.wolfram.com/Matching.html) problem.
174174
`optimizer` and `simplifier` are for tensor network optimization, check `optimize_code` for details.
175+
176+
Problem definition
177+
---------------------------
178+
A ``k``-matching in a graph ``G`` is a set of k edges, no two of which have a vertex in common.
179+
180+
Graph polynomial
181+
---------------------------
175182
The matching polynomial adopts the first definition in [wiki page](https://en.wikipedia.org/wiki/Matching_polynomial)
176183
```math
177-
m_G(x) := \\sum_{k\\geq 0}m_kx^k,
184+
M(G, x) = \\sum\\limits_{k=1}^{|V|/2} c_k x^k,
178185
```
179-
where `m_k` is the number of k-edge matchings.
186+
where ``k`` is the number of matches, and coefficients ``c_k`` are the corresponding counting.
187+
188+
Tensor network
189+
---------------------------
190+
We map an edge ``(u, v) \\in E`` to a label ``\\langle u, v\\rangle \\in \\{0, 1\\}`` in a tensor network,
191+
where 1 means two vertices of an edge are matched, 0 means otherwise.
192+
Then we define a tensor of rank ``d(v) = |N(v)|`` on vertex ``v`` such that,
193+
```math
194+
W_{\\langle v, n_1\\rangle, \\langle v, n_2 \\rangle, \\ldots, \\langle v, n_{d(v)}\\rangle} = \\begin{cases}
195+
1, & \\sum_{i=1}^{d(v)} \\langle v, n_i \\rangle \\leq 1,\\\\
196+
0, & \\text{otherwise},
197+
\\end{cases}
198+
```
199+
and a tensor of rank 1 on the bond
200+
```math
201+
B_{\\langle v, w\\rangle} = \\begin{cases}
202+
1, & \\langle v, w \\rangle = 0 \\\\
203+
x, & \\langle v, w \\rangle = 1,
204+
\\end{cases}
205+
```
206+
where label ``\\langle v, w \\rangle`` is equivalent to ``\\langle w,v\\rangle``.
180207
"""
181208
struct Matching{CT<:EinTypes} <: GraphProblem
182209
code::CT
@@ -193,8 +220,33 @@ end
193220
Coloring{K,CT<:EinTypes} <: GraphProblem
194221
Coloring{K}(graph; openvertices=(), optimizer=GreedyMethod(), simplifier=nothing)
195222
196-
K-Coloring problem.
223+
[Vertex Coloring](https://en.wikipedia.org/wiki/Graph_coloring) problem.
197224
`optimizer` and `simplifier` are for tensor network optimization, check `optimize_code` for details.
225+
226+
Problem definition
227+
---------------------------
228+
A vertex coloring is an assignment of labels or colors to each vertex of a graph such that no edge connects two identically colored vertices.
229+
230+
Tensor network
231+
---------------------------
232+
Let us use 3-colouring problem defined on vertices as an example.
233+
For a vertex ``v``, we define the degree of freedoms ``c_v\\in\\{1,2,3\\}`` and a vertex tensor labelled by it as
234+
```math
235+
W(v) = \\left(\\begin{matrix}
236+
r_v\\\\
237+
g_v\\\\
238+
b_v
239+
\\end{matrix}\\right).
240+
```
241+
For an edge ``(u, v)``, we define an edge tensor as a matrix labelled by ``(c_u, c_v)`` to specify the constraint
242+
```math
243+
B = \\left(\\begin{matrix}
244+
0 & 1 & 1\\\\
245+
1 & 0 & 1\\\\
246+
1 & 1 & 0
247+
\\end{matrix}\\right).
248+
```
249+
The number of possible colouring can be obtained by contracting this tensor network by setting vertex tensor elements ``r_v, g_v`` and ``b_v`` to 1.
198250
"""
199251
struct Coloring{K,CT<:EinTypes} <: GraphProblem
200252
code::CT

0 commit comments

Comments
 (0)