You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/weighted.jl
+11-6Lines changed: 11 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,12 @@ using GenericTensorNetworks, Graphs
5
5
6
6
graph = Graphs.smallgraph(:petersen)
7
7
8
-
# The following code computes the weighted MIS problem.
8
+
# The following code constructs a weighted MIS problem instance.
9
9
problem =IndependentSet(graph; weights=collect(1:10));
10
10
11
-
# `weights` is a key word argument that can be a vector for weighted graphs or a `NoWeight()` object for unweighted graphs. The maximum independent set can be found as follows.
11
+
# Here, the `weights` keyword argument can be a vector for weighted graphs or `NoWeight()` for unweighted graphs.
12
+
# Most solution space properties work for unweighted graphs also work for the weighted graphs.
13
+
# For example, the maximum independent set can be found as follows.
# For weighted MIS problem, a property that many people care about is the "energy spectrum", or the largest weights.
24
-
# We just feed a positional argument in the [`SizeMax`](@ref) constructor as the number of largest weights.
25
+
# The only solution space property that can not be defined for general real-weighted (not including integer-weighted) graphs is the [`GraphPolynomial`](@ref).
26
+
27
+
# For the weighted MIS problem, a useful solution space property is the "energy spectrum", i.e. the largest several configurations and their weights.
28
+
# We can use the solution space property is [`SizeMax`](@ref)`(10)` to compute the largest 10 weights.
25
29
spectrum =solve(problem, SizeMax(10))[]
26
30
27
-
# The return value has type [`ExtendedTropical`](@ref), which contains one field `orders`. The `orders` is a vector of [`Tropical`](@ref) numbers.
31
+
# The return value has type [`ExtendedTropical`](@ref), which contains one field `orders`.
28
32
spectrum.orders
29
33
30
-
# We can get weighted independent sets with maximum 5 sizes.
34
+
# We can see the `order` is a vector of [`Tropical`](@ref) numbers.
35
+
# Similarly, we can get weighted independent sets with maximum 5 sizes as follows.
# The return value also has type [`ExtendedTropical`](@ref), but this time the element type of `orders` has been changed to [`CountingTropical`](@ref)`{Float64,`[`ConfigSampler`](@ref)`}`.
0 commit comments