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
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.
9
+
7
10
## Background knowledge
8
11
9
12
Please check our paper ["Computing properties of independent sets by generic programming tensor networks"]().
10
-
If you find our paper or software useful in your work, please cite us.
13
+
If you find our paper or software useful in your work, please cite us:
14
+
15
+
```bibtex
16
+
(bibtex to be added)
17
+
```
11
18
12
19
## Quick start
13
20
14
-
You can find a good installation guide and a quick start in our [README](https://github.com/Happy-Diode/GraphTensorNetworks.jl).
21
+
You can find a good installation guide and a quick start in our [README](https://github.com/Happy-Diode/GraphTensorNetworks.jl).
22
+
23
+
A good example to start with is the [Independent set problem](@ref).
Copy file name to clipboardExpand all lines: examples/IndependentSet/main.jl
+51-5Lines changed: 51 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -22,24 +22,36 @@ problem = Independence(graph; optimizer=TreeSA(sc_weight=1.0, ntrials=10,
22
22
βs=0.01:0.1:15.0, niters=20, rw_weight=0.2),
23
23
simplifier=MergeGreedy());
24
24
25
+
# The `optimizer` is for optimizing the contraction orders.
26
+
# Here we use the local search based optimizer in [arXiv:2108.05665](https://arxiv.org/abs/2108.05665).
27
+
# If no optimizer is specified, the default fast (in terms of the speed of searching contraction order)
28
+
# but worst (in term of contraction complexity) [`GreedyMethod`](@ref) will be used.
29
+
# `simplifier` is a preprocessing routine to speed up the `optimizer`.
30
+
# Please check section [Tensor Network](@ref) for more details.
31
+
# One can check the time, space and read-write complexity with the following function.
32
+
33
+
timespacereadwrite_complexity(problem)
34
+
35
+
# The return values are `log2` of the the number of iterations, the number elements in the max tensor and the number of read-write operations to tensor elements.
# For the definition of independence polynomial, please check the docstring of [`Independence`](@ref) or this [wiki page](https://mathworld.wolfram.com/IndependencePolynomial.html).
40
52
# There are 3 methods to compute a graph polynomial, `:finitefield`, `:fft` and `:polynomial`.
41
53
# These methods are introduced in the docstring of [`GraphPolynomial`](@ref).
locations = [[rot15(0.0, 1.0, i) for i=0:4]..., [rot15(0.0, 0.6, i) for i=0:4]...]
25
+
26
+
show_graph(graph; locs=locations)
27
+
28
+
# Then we define the maximal independent set problem as
29
+
problem =MaximalIndependence(graph);
30
+
31
+
# The tensor network structure is different from that of [`Independence`](@ref),
32
+
# Its tensor is defined on a vertex and its neighbourhood,
33
+
# and it makes the contraction of [`MaximalIndependence`](@ref) much harder.
34
+
35
+
# ## Solving properties
36
+
37
+
# ### Counting properties
38
+
# ##### maximal independence polynomial
39
+
max_config =solve(problem, GraphPolynomial())[]
40
+
41
+
# Since it only counts the maximal independent sets, the first several coefficients are 0.
42
+
43
+
# ### Configuration properties
44
+
# ##### finding all maximal independent set
45
+
max_edge_config =solve(problem, ConfigsAll())[]
46
+
47
+
# This result should be consistent with that given by the [Bron Kerbosch algorithm](https://en.wikipedia.org/wiki/Bron%E2%80%93Kerbosch_algorithm) on the complement of Petersen graph.
0 commit comments