A complementer graph contains all edges that were not present in the input graph.
Details
complementer()
creates the complementer of a graph. Only edges
which are not present in the original graph will be included in the
new graph.
complementer()
keeps graph and vertex attriubutes, edge
attributes are lost.
See also
Other functions for manipulating graph structure:
+.igraph()
,
add_edges()
,
add_vertices()
,
compose()
,
connect()
,
contract()
,
delete_edges()
,
delete_vertices()
,
difference()
,
difference.igraph()
,
disjoint_union()
,
edge()
,
igraph-minus
,
intersection()
,
intersection.igraph()
,
path()
,
permute()
,
rep.igraph()
,
reverse_edges()
,
simplify()
,
union()
,
union.igraph()
,
vertex()
Author
Gabor Csardi csardi.gabor@gmail.com
Examples
## Complementer of a ring
g <- make_ring(10)
complementer(g)
#> IGRAPH 4ea278b U--- 10 35 -- Ring graph
#> + attr: name (g/c), mutual (g/l), circular (g/l)
#> + edges from 4ea278b:
#> [1] 1-- 9 1-- 8 1-- 7 1-- 6 1-- 5 1-- 4 1-- 3 2--10 2-- 9 2-- 8 2-- 7 2-- 6
#> [13] 2-- 5 2-- 4 3--10 3-- 9 3-- 8 3-- 7 3-- 6 3-- 5 4--10 4-- 9 4-- 8 4-- 7
#> [25] 4-- 6 5--10 5-- 9 5-- 8 5-- 7 6--10 6-- 9 6-- 8 7--10 7-- 9 8--10
## A graph and its complementer give together the full graph
g <- make_ring(10)
gc <- complementer(g)
gu <- union(g, gc)
gu
#> IGRAPH be3d21d U--- 10 45 --
#> + attr: name_1 (g/c), name_2 (g/c), mutual_1 (g/l), mutual_2 (g/l),
#> | circular_1 (g/l), circular_2 (g/l)
#> + edges from be3d21d:
#> [1] 9--10 8--10 8-- 9 7--10 7-- 9 7-- 8 6--10 6-- 9 6-- 8 6-- 7 5--10 5-- 9
#> [13] 5-- 8 5-- 7 5-- 6 4--10 4-- 9 4-- 8 4-- 7 4-- 6 4-- 5 3--10 3-- 9 3-- 8
#> [25] 3-- 7 3-- 6 3-- 5 3-- 4 2--10 2-- 9 2-- 8 2-- 7 2-- 6 2-- 5 2-- 4 2-- 3
#> [37] 1--10 1-- 9 1-- 8 1-- 7 1-- 6 1-- 5 1-- 4 1-- 3 1-- 2
graph.isomorphic(gu, make_full_graph(vcount(g)))
#> [1] TRUE