[ library(grasper) | Reference Manual | Alphabetic Index ]

complementary_graph(+Graph, ?ComplementaryGraph)

Obtains the complementary graph of a given graph.
Graph
A graph.
ComplementaryGraph
The complementary graph of Graph.

Description

Obtains the complementary graph of a given graph.

Fail Conditions

Fails if Graph is not a graph variable or if Graph can not be constrained to have ComplementaryGraph as its complementary graph (ComplementarGraph is a graph variable).

Examples

?- complementary_graph(G,CG).
No.

?- V`::[]..[1,2,3], E`::[[1,2]]..[[1,2],[2,3],[3,1]], CE`::[]..[[1,2],[3,2],[1,3]], dirgraph(G,V,E), dirgraph(CG,V,CE), complementary_graph(G,CG).
No.

?- V`::[]..[1,2,3], E`::[[1,2]]..[[1,2],[2,3],[3,1]], dirgraph(G,V,E), complementary_graph(G,CG), graph_labeling(G).
V = [1, 2]
E = [[1, 2]]
G = dirgraph([1, 2], [[1, 2]])
CG = dirgraph([1, 2], [[1, 1], [2, 1], [2, 2]])
Yes ? ;

V = [1, 2, 3]
E = [[1, 2]]
G = dirgraph([1, 2, 3], [[1, 2]])
CG = dirgraph([1, 2, 3], [[1, 1], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]])
Yes ? ;

V = [1, 2, 3]
E = [[1, 2], [3, 1]]
G = dirgraph([1, 2, 3], [[1, 2], [3, 1]])
CG = dirgraph([1, 2, 3], [[1, 1], [1, 3], [2, 1], [2, 2], [2, 3], [3, 2], [3, 3]])
Yes ? ;

V = [1, 2, 3]
E = [[1, 2], [2, 3]]
G = dirgraph([1, 2, 3], [[1, 2], [2, 3]])
CG = dirgraph([1, 2, 3], [[1, 1], [1, 3], [2, 1], [2, 2], [3, 1], [3, 2], [3, 3]])
Yes ? ;

V = [1, 2, 3]
E = [[1, 2], [2, 3], [3, 1]]
G = dirgraph([1, 2, 3], [[1, 2], [2, 3], [3, 1]])
CG = dirgraph([1, 2, 3], [[1, 1], [1, 3], [2, 1], [2, 2], [3, 2], [3, 3]])
Yes

?- V`::[]..[1,2,3], E`::[]..[[1,2],[2,3],[3,1]], CE`::[[2,3],[3,2]]..[[1,2],[1,3],[2,1],[2,2],[2,3],[3,1],[3,2],[3,3]], dirgraph(G,V,E), dirgraph(CG,V,CE), complementary_graph(G,CG), graph_labeling(G).
V = [2, 3]
E = []
CE = [[2, 2], [2, 3], [3, 2], [3, 3]]
G = dirgraph([2, 3], [])
CG = dirgraph([2, 3], [[2, 2], [2, 3], [3, 2], [3, 3]])
Yes