Skip to content

Commit 9175101

Browse files
committed
docs and example
1 parent 535498f commit 9175101

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ solve(
4141
Here the main function [`solve`](@ref) takes three input arguments, the problem instance of type [`IndependentSet`](@ref), the property instance of type [`GraphPolynomial`](@ref) and an optional key word argument `usecuda` to decide use GPU or not.
4242
If one wants to use GPU to accelerate the computation, the `, CUDA` should be uncommented.
4343

44-
An [`IndependentSet`](@ref) instance takes two positional arguments to initialize, the graph instance that one wants to solve and the weights for each vertex. Here, we use a random regular graph with 20 vertices and degree 3, and the default uniform weight 1.
44+
An [`IndependentSet`](@ref) instance takes two positional arguments to initialize, the graph instance that one wants to solve and the get_weights for each vertex. Here, we use a random regular graph with 20 vertices and degree 3, and the default uniform weight 1.
4545

4646
The [`GenericTensorNetwork`](@ref) function is a constructor for the problem instance, which takes the problem instance as the first argument and optional key word arguments. The key word argument `optimizer` is for specifying the tensor network optimization algorithm.
4747
The keyword argument `openvertices` is a tuple of labels for specifying the degrees of freedom not summed over, and `fixedvertices` is a label-value dictionary for specifying the fixed values of the degree of freedoms.

docs/src/ref.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# References
2-
## Graph problems
2+
## Constraint Satisfaction Problems
33
```@docs
44
solve
55
GenericTensorNetwork
6-
GraphProblem
6+
ConstraintSatisfactionProblem
77
IndependentSet
88
MaximalIS
99
Matching
@@ -18,9 +18,9 @@ SetPacking
1818
OpenPitMining
1919
```
2020

21-
#### Graph Problem Interfaces
21+
#### Constraint Satisfaction Problem Interfaces
2222

23-
To subtype [`GraphProblem`](@ref), a new type must contain a `code` field to represent the (optimized) tensor network.
23+
To subtype [`ConstraintSatisfactionProblem`](@ref), a new type must contain a `code` field to represent the (optimized) tensor network.
2424
Interfaces [`GenericTensorNetworks.generate_tensors`](@ref), [`labels`](@ref), [`flavors`](@ref) and [`get_weights`](@ref) are required.
2525
[`nflavor`](@ref) is optional.
2626

@@ -30,12 +30,12 @@ labels
3030
energy_terms
3131
flavors
3232
get_weights
33-
chweights
33+
set_weights
3434
nflavor
3535
fixedvertices
3636
```
3737

38-
#### Graph Problem Utilities
38+
#### Constraint Satisfaction Problem Utilities
3939
```@docs
4040
is_independent_set
4141
is_maximal_independent_set

examples/MaxCut.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# In graph theory, a [cut](https://en.wikipedia.org/wiki/Cut_(graph_theory)) is a partition of the vertices of a graph into two disjoint subsets.
88
# It is closely related to the [Spin-glass problem](@ref) in physics.
99
# Finding the maximum cut is NP-Hard, where a maximum cut is a cut whose size is at least the size of any other cut,
10-
# where the size of a cut is the number of edges (or the sum of weights on edges) crossing the cut.
10+
# where the size of a cut is the number of edges (or the sum of get_weights on edges) crossing the cut.
1111

1212
using GenericTensorNetworks, Graphs
1313

@@ -40,7 +40,7 @@ problem = GenericTensorNetwork(maxcut)
4040
# where ``w_{ij}`` is a real number associated with edge ``(i, j)`` as the edge weight.
4141
# If and only if the bipartition cuts on edge ``(i, j)``,
4242
# this tensor contributes a factor ``x_{i}^{w_{ij}}`` or ``x_{j}^{w_{ij}}``.
43-
# Similarly, one can assign weights to vertices, which corresponds to the onsite energy terms in the spin glass.
43+
# Similarly, one can assign get_weights to vertices, which corresponds to the onsite energy terms in the spin glass.
4444
# The vertex tensor is
4545
# ```math
4646
# W(x_i, w_i) = \left(\begin{matrix}

examples/SpinGlass.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ hyperedges = [[1,3,4,6,7], [4,7,8,12], [2,5,9,11,13],
106106
[1,2,14,15], [3,6,10,12,14], [8,14,15],
107107
[1,2,6,11], [1,2,4,6,8,12]]
108108

109-
weights = [-1, 1, -1, 1, -1, 1, -1, 1];
109+
get_weights = [-1, 1, -1, 1, -1, 1, -1, 1];
110110

111111
# The energy function of the spin glass problem is
112112
# ```math
@@ -117,7 +117,7 @@ weights = [-1, 1, -1, 1, -1, 1, -1, 1];
117117
# \end{align*}
118118
# ```
119119
# A spin glass problem can be defined with the [`SpinGlass`](@ref) type as
120-
hyperspinglass = SpinGlass(num_vertices, hyperedges, weights)
120+
hyperspinglass = SpinGlass(num_vertices, hyperedges, get_weights)
121121

122122
# The tensor network representation of the set packing problem can be obtained by
123123
hyperproblem = GenericTensorNetwork(hyperspinglass)

examples/weighted.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ show_graph(graph, locations; format=:svg, vertex_colors=
2626

2727
# The only solution space property that can not be defined for general real-weighted (not including integer-weighted) graphs is the [`GraphPolynomial`](@ref).
2828

29-
# For the weighted MIS problem, a useful solution space property is the "energy spectrum", i.e. the largest several configurations and their weights.
30-
# We can use the solution space property is [`SizeMax`](@ref)`(10)` to compute the largest 10 weights.
29+
# For the weighted MIS problem, a useful solution space property is the "energy spectrum", i.e. the largest several configurations and their get_weights.
30+
# We can use the solution space property is [`SizeMax`](@ref)`(10)` to compute the largest 10 get_weights.
3131
spectrum = solve(problem, SizeMax(10))[]
3232

3333
# The return value has type [`ExtendedTropical`](@ref), which contains one field `orders`.

0 commit comments

Comments
 (0)