Skip to content

Commit 513181b

Browse files
committed
Merge branch 'memory-estimation'
2 parents ec3e9d9 + ee73de9 commit 513181b

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CurrentModule = GraphTensorNetworks
55
# GraphTensorNetworks
66

77
This package uses generic tensor network to compute properties of combinatorial problems defined on graph.
8-
The properties includes the size of the maximum set size, the number of sets of a given size and the enumeration of configurations of a given set size.
8+
The properties includes the size of the maximum/minimum set size, the number of sets of a given size and the enumeration of configurations of a given set size.
99

1010
## Background knowledge
1111

examples/IndependentSet.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ show_graph(graph; locs=locations)
2424

2525
# ## Tensor network representation
2626
# Let ``G=(V,E)`` be the target graph that we want to solve.
27-
# The tensor network representation map a vertex ``i\in V`` to a label ``s_i \in \{0, 1\}`` of dimension ``2`` in a tensor network, where we use ``0`` (``1``) to denote a vertex is absent (present) in the set.
27+
# We map a vertex ``i\in V`` to a label ``s_i \in \{0, 1\}`` of dimension ``2`` in a tensor network, where we use ``0`` (``1``) to denote a vertex is absent (present) in the set.
2828
# For each label ``s_i``, we defined a parametrized rank-one vertex tensor ``W(x_i)`` as
2929
# ```math
3030
# W(x_i) = \left(\begin{matrix}
3131
# 1 \\
32-
# x_i
33-
# \end{matrix}\right).
32+
# x_i^{w_i}
33+
# \end{matrix}\right),
3434
# ```
35-
# We use subscripts to index tensor elements, e.g. ``W(x_i)_0=1`` is the first element associated with ``s_i=0`` and ``W(x_i)_1=x_i`` is the second element associated with ``s_i=1``.
35+
# where ``W(x_i)_0=1`` is the first element associated with ``s_i=0`` and ``W(x_i)_1=x_i^{w_i}`` is the second element associated with ``s_i=1``, and `w_i` is the weight of vertex ``i``.
3636
# Similarly, on each edge ``(u, v)``, we define a matrix ``B`` indexed by ``s_u`` and ``s_v`` as
3737
# ```math
3838
# B = \left(\begin{matrix}

examples/MaxCut.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ show_graph(graph; locs=locations)
3030
# Then the maximum cutting problem can be encoded to tensor networks by mapping an edge ``(i,j)\in E`` to an edge matrix labelled by ``s_is_j``
3131
# ```math
3232
# B(x_{\langle i, j\rangle}) = \left(\begin{matrix}
33-
# 1 & x_{\langle i, j\rangle}\\
34-
# x_{\langle i, j\rangle} & 1
33+
# 1 & x_{\langle i, j\rangle}^{w_{\langle i,j \rangle}}\\
34+
# x_{\langle i, j\rangle}^{w_{\langle i,j \rangle}} & 1
3535
# \end{matrix}\right),
3636
# ```
37-
# where variable ``x_{\langle i, j\rangle}`` represents a cut on edge ``(i, j)`` or a domain wall of an Ising spin glass.
37+
# If and only if there is a cut on edge ``(i, j)``,
38+
# this tensor contributes a factor ``x_{\langle i, j\rangle}^{w_{\langle i,j \rangle}}``,
39+
# where ``w_{\langle i,j\rangle}`` is the weight of this edge.
3840
# Similar to other problems, we can define a polynomial about edges variables by setting ``x_{\langle i, j\rangle} = x``,
3941
# where its k-th coefficient is two times the number of configurations of cut size k.
4042
# We define the cutting problem as

examples/MaximalIS.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ show_graph(graph; locs=locations)
2929
# We defined the restriction on its neighbourhood ``N(v)``:
3030
# ```math
3131
# T(x_v)_{s_1,s_2,\ldots,s_{|N(v)|},s_v} = \begin{cases}
32-
# s_vx_v & s_1=s_2=\ldots=s_{|N(v)|}=0,\\
32+
# s_vx_v^{w_v} & s_1=s_2=\ldots=s_{|N(v)|}=0,\\
3333
# 1-s_v& \text{otherwise}.
3434
# \end{cases}
3535
# ```
36-
# Intuitively, it means if all the neighbourhood vertices are not in ``I_{m}``, i.e., ``s_1=s_2=\ldots=s_{|N(v)|}=0``, then ``v`` should be in ``I_{m}`` and contribute a factor ``x_{v}``,
37-
# otherwise, if any of the neighbourhood vertices is in ``I_{m}``, then ``v`` cannot be in ``I_{m}``.
36+
# The first case corresponds to all the neighbourhood vertices of ``v`` are not in ``I_{m}``, then ``v`` must be in ``I_{m}`` and contribute a factor ``x_{v}^{w_v}``,
37+
# where ``w_v`` is the weight of vertex ``v``.
38+
# Otherwise, if any of the neighbouring vertices of ``v`` is in ``I_{m}``, ``v`` must not be in ``I_{m}`` by the independence requirement.
3839
# We can use [`MaximalIS`](@ref) to construct the tensor network for solving the maximal independent set problem as
3940
problem = MaximalIS(graph; optimizer=TreeSA());
4041

0 commit comments

Comments
 (0)