@@ -46,9 +46,94 @@ function plot(
4646 locs_x,
4747 reverse (locs_y),
4848 nodefillc= col_nodes)
49- # nodelabel=LG.vertices(g),
50- # arrowlengthfrac=0.05
51- # edgestrokec=col_edges
52-
5349 return p
5450end
51+
52+ function plot (
53+ hcg:: HardCoreGraph ,
54+ state,
55+ width:: Int = 0 ,
56+ height:: Int = 0
57+ )
58+ col_nodes = [Colors. colorant " turquoise" for _ in 1 : LG. nv (hcg. g)]
59+ col_nodes[state] .= Colors. colorant " red"
60+
61+ if width == 0 || height == 0
62+ p = GraphPlot. gplot (hcg. g,
63+ nodelabel= LG. vertices (hcg. g),
64+ nodefillc= col_nodes
65+ )
66+ return p
67+ else
68+ pos = collect (Iterators. product (1 : height, 1 : width))[:]
69+ locs_x, locs_y = map (x-> x[1 ], pos), map (x-> x[2 ], pos)
70+
71+ p = GraphPlot. gplot (hcg. g,
72+ locs_x, locs_y,
73+ nodelabel= LG. vertices (hcg. g),
74+ nodefillc= col_nodes
75+ )
76+ return p
77+ end
78+ end
79+
80+ function plot (
81+ rsf:: RootedSpanningForest ,
82+ sample,
83+ width:: Int = 0 ,
84+ height:: Int = 0
85+ )
86+ col_nodes, col_edges = color_cycles (sample)
87+ col_nodes[collect (rsf. roots)] .= Colors. colorant " orange"
88+
89+ if width == 0 || height == 0
90+ p = GraphPlot. gplot (sample,
91+ nodelabel= LG. vertices (sample),
92+ nodefillc= col_nodes,
93+ edgestrokec= col_edges,
94+ arrowlengthfrac= 0.05 ,
95+ )
96+ return p
97+ else
98+ pos = collect (Iterators. product (1 : height, 1 : width))[:]
99+ locs_x, locs_y = map (x-> x[1 ], pos), map (x-> x[2 ], pos)
100+
101+ p = GraphPlot. gplot (sample,
102+ locs_x, locs_y,
103+ nodelabel= LG. vertices (sample),
104+ nodefillc= col_nodes,
105+ edgestrokec= col_edges,
106+ arrowlengthfrac= 0.05 ,
107+ )
108+ return p
109+ end
110+ end
111+
112+ function plot (
113+ sfg:: SinkFreeGraph ,
114+ sample,
115+ width:: Int = 0 ,
116+ height:: Int = 0
117+ )
118+ col_nodes = [LG. outdegree (sample, v) == 0 ? colorant " red" : colorant " turquoise"
119+ for v in LG. vertices (sample)]
120+ if width == 0 || height == 0
121+ p = GraphPlot. gplot (sample,
122+ nodelabel= LG. vertices (sample),
123+ nodefillc= col_nodes,
124+ arrowlengthfrac= 0.05 ,
125+ )
126+ return p
127+ else
128+ pos = collect (Iterators. product (1 : height, 1 : width))[:]
129+ locs_x, locs_y = map (x-> x[1 ], pos), map (x-> x[2 ], pos)
130+
131+ p = GraphPlot. gplot (sample,
132+ locs_x, locs_y,
133+ nodelabel= LG. vertices (sample),
134+ nodefillc= col_nodes,
135+ arrowlengthfrac= 0.05 ,
136+ )
137+ return p
138+ end
139+ end
0 commit comments