plot_cover {gor} | R Documentation |
Vertex cover plotting
Description
Plot of a vertex cover in a graph.
Usage
plot_cover(X, G)
Arguments
X |
Cover to be plotted; an output list returned by some cover-building function, see below. |
G |
Graph on which to superimpose the cover. |
Details
It plots a graph, then superimposes a vertex cover in a different color. It also draws the covered edges, to help in detecting non-covers by inspection.
Value
This function is called for its side effect of plotting.
Author(s)
Cesar Asensio
See Also
is_cover checks if a vertex subset is a vertex cover, build_cover_greedy builds a cover using a greedy heuristic, build_cover_approx builds a cover using a 2-approximation algorithm, improve_cover_flip improves a cover using local search, search_cover_random looks for a random cover of fixed size, search_cover_ants looks for a random cover using a version of the ant-colony optimization heuristic, find_cover_BB finds covers using a branch-and-bound technique.
Examples
set.seed(1)
g <- sample_gnp(25, p=0.25) # Random graph
X1 <- build_cover_greedy(g)
plot_cover(X1, g)
st <- 1:5 # Not a vertex cover
plot_cover(list(set = st, size = length(st)), g) # See covered edges