Skip to content

Commit 1d9dd7c

Browse files
committed
update docs
1 parent f3b454a commit 1d9dd7c

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

examples/Matching.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,6 @@ matching_poly = solve(problem, GraphPolynomial())[]
6969
match_config = solve(problem, SingleConfigMax())[]
7070

7171
# Let us show the result by coloring the matched edges to red
72-
show_graph(graph; locs=locations, edge_colors=[isone(match_config.c.data[i]) ? "red" : "black" for i=1:ne(graph)])
72+
show_graph(graph; locs=locations, edge_colors=[isone(match_config.c.data[i]) ? "red" : "black" for i=1:ne(graph)])
73+
74+
# where we use edges with red color to related pairs of matched vertices.

examples/MaxCut.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,6 @@ max_cut_size_verify = cut_size(graph, max_vertex_config)
7272
# You should see a consistent result as above `max_cut_size`.
7373

7474
show_graph(graph; locs=locations, vertex_colors=[
75-
iszero(max_vertex_config[i]) ? "white" : "red" for i=1:nv(graph)])
75+
iszero(max_vertex_config[i]) ? "white" : "red" for i=1:nv(graph)])
76+
77+
# where red vertices and white vertices are seperated by the cut.

examples/PaintShop.jl

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ for i=1:length(sequence)
3232
i != j && add_edge!(graph, i, j)
3333
end
3434

35-
show_graph(graph; locs=locations, texts=string.(sequence), edge_colors=[sequence[e.src] == sequence[e.dst] ? "blue" : "black" for e in edges(graph)])
35+
show_graph(graph; locs=locations, texts=string.(sequence), edge_colors=
36+
[sequence[e.src] == sequence[e.dst] ? "blue" : "black" for e in edges(graph)])
3637

3738
# Vertices connected by blue edges must have different colors,
3839
# and the goal becomes a min-cut problem defined on black edges.
@@ -80,25 +81,22 @@ max_config = solve(problem, GraphPolynomial())[]
8081
# ```math
8182
# D(G, x) = \sum_{k=0}^{\delta(G)} d_k x^k
8283
# ```
83-
# where ``2d_k`` is the number of possible coloring with number of color changes ``2m-1-k``.
84+
# where ``d_k`` is the number of possible coloring with number of color changes ``2m-1-k``.
8485
paint_polynomial = solve(problem, GraphPolynomial())[]
8586

8687
# ### Configuration properties
8788
# ##### finding best solutions
8889
best_configs = solve(problem, ConfigsMax())[]
8990

90-
painting1 = paint_shop_coloring_from_config(best_configs.c.data[1]; initial=false)
91-
92-
show_graph(graph; locs=locations, texts=string.(sequence), edge_colors=[sequence[e.src] == sequence[e.dst] ? "blue" : "black" for e in edges(graph)],
93-
vertex_colors=[isone(c) ? "red" : "black" for c in painting1], vertex_text_color="white")
91+
# One can see to identical bitstrings corresponding two different vertex configurations, they are related to bit-flip symmetry.
9492

95-
#
93+
painting1 = paint_shop_coloring_from_config(best_configs.c.data[1]; initial=false)
9694

97-
painting2 = paint_shop_coloring_from_config(best_configs.c.data[2]; initial=false)
95+
show_graph(graph; locs=locations, texts=string.(sequence),
96+
edge_colors=[sequence[e.src] == sequence[e.dst] ? "blue" : "black" for e in edges(graph)],
97+
vertex_colors=[isone(c) ? "red" : "black" for c in painting1], vertex_text_color="white")
9898

99-
show_graph(graph; locs=locations, texts=string.(sequence), edge_colors=[sequence[e.src] == sequence[e.dst] ? "blue" : "black" for e in edges(graph)],
100-
vertex_colors=[isone(c) ? "red" : "black" for c in painting2], vertex_text_color="white")
99+
# Since we have different choices of initial color, the number of best solution is 2.
101100

102-
# Since we have different choices of initial color, the number of best solution is 4.
103101
# The following function will check the solution and return you the number of color switchs
104102
num_paint_shop_color_switch(sequence, painting1)

0 commit comments

Comments
 (0)