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
* Create CUDA and GenericTensorNetworks extensions
* update project version
* fix document
* fix documentation
* prevent long vector
* fix the energy mode
# The solution space hard-core lattice gas is equivalent to that of an independent set problem.
39
40
# The independent set problem involves finding a set of vertices in a graph such that no two vertices in the set are adjacent (i.e., there is no edge connecting them).
40
41
# One can create a tensor network based modeling of an independent set problem with package [`GenericTensorNetworks.jl`](https://github.com/QuEraComputing/GenericTensorNetworks.jl).
41
-
using GenericTensorNetworks
42
42
problem =IndependentSet(graph)
43
43
44
44
# There are plenty of discussions related to solution space properties in the `GenericTensorNetworks` [documentaion page](https://queracomputing.github.io/GenericTensorNetworks.jl/dev/generated/IndependentSet/).
@@ -59,14 +59,14 @@ partition_func[]
59
59
60
60
# The marginal probabilities can be computed with the [`marginals`](@ref) function, which measures how likely a site is occupied.
61
61
mars =marginals(pmodel)
62
-
show_graph(graph, sites; vertex_colors=[(b = mars[[i]][2]; (1-b, 1-b, 1-b)) for i in1:nv(graph)], texts=fill("", nv(graph)))
62
+
show_graph(SimpleGraph(graph), sites; vertex_colors=[(b = mars[[i]][2]; (1-b, 1-b, 1-b)) for i in1:nv(graph)], texts=fill("", nv(graph)))
63
63
# The can see the sites at the corner is more likely to be occupied.
64
64
# To obtain two-site correlations, one can set the variables to query marginal probabilities manually.
65
65
pmodel2 =TensorNetworkModel(problem, β; mars=[[e.src, e.dst] for e inedges(graph)])
66
66
mars =marginals(pmodel2);
67
67
68
68
# We show the probability that both sites on an edge are not occupied
69
-
show_graph(graph, sites; edge_colors=[(b = mars[[e.src, e.dst]][1, 1]; (1-b, 1-b, 1-b)) for e inedges(graph)], texts=fill("", nv(graph)), config=GraphDisplayConfig(; edge_line_width=5))
69
+
show_graph(SimpleGraph(graph), sites; edge_colors=[(b = mars[[e.src, e.dst]][1, 1]; (1-b, 1-b, 1-b)) for e inedges(graph)], texts=fill("", nv(graph)), config=GraphDisplayConfig(; edge_line_width=5))
70
70
71
71
# ## The most likely configuration
72
72
# The MAP and MMAP can be used to get the most likely configuration given an evidence.
@@ -77,7 +77,7 @@ mars = marginals(pmodel3)
77
77
logp, config =most_probable_config(pmodel3)
78
78
79
79
# The log probability is 102. Let us visualize the configuration.
80
-
show_graph(graph, sites; vertex_colors=[(1-b, 1-b, 1-b) for b in config], texts=fill("", nv(graph)))
80
+
show_graph(SimpleGraph(graph), sites; vertex_colors=[(1-b, 1-b, 1-b) for b in config], texts=fill("", nv(graph)))
0 commit comments