[ library(grasper) | Third Party Libraries | Reference Manual | Alphabetic Index ]
# reverse_graph(+Graph, ?ReverseGraph)

Obtains the reverse graph of a given graph.
*Graph*
- A graph.
*ReverseGraph*
- The reverse graph of Graph.

## Description

Obtains the reverse graph of a given graph.
### Fail Conditions

Fails
if Graph is not a graph variable or
if Graph can not be contrained to have ReverseGraph as its reverse graph (ReverseGraph is a graph variable).
## Examples

?- reverse_graph(G,RG).
No.
?- V`::[]..[1,2,3], E`::[[1,2]]..[[1,2],[2,3],[3,1]], dirgraph(G,V,E), dirgraph(RG,V,E), reverse_graph(G,RG).
No.
?- V`::[]..[1,2,3], E`::[]..[[1,2],[2,3],[3,1]], dirgraph(G,V,E), reverse_graph(G,RG), size(G,2), graph_labeling(G).
V = [1, 2, 3]
E = [[2, 3], [3, 1]]
G = dirgraph([1, 2, 3], [[2, 3], [3, 1]])
RG = dirgraph([1, 2, 3], [[1, 3], [3, 2]])
Yes ? ;
V = [1, 2, 3]
E = [[1, 2], [3, 1]]
G = dirgraph([1, 2, 3], [[1, 2], [3, 1]])
RG = dirgraph([1, 2, 3], [[1, 3], [2, 1]])
Yes ? ;
V = [1, 2, 3]
E = [[1, 2], [2, 3]]
G = dirgraph([1, 2, 3], [[1, 2], [2, 3]])
RG = dirgraph([1, 2, 3], [[2, 1], [3, 2]])
Yes
?- V`::[]..[1,2,3], E`::[[1,2]]..[[1,2],[2,3],[3,1]], RE`::[[3,2]]..[[1,3],[2,1],[3,2]], dirgraph(G,V,E), dirgraph(RG,V,RE), reverse_graph(G,RG), graph_labeling(G).
V = [1, 2, 3]
E = [[1, 2], [2, 3]]
RE = [[2, 1], [3, 2]]
G = dirgraph([1, 2, 3], [[1, 2], [2, 3]])
RG = dirgraph([1, 2, 3], [[2, 1], [3, 2]])
Yes ? ;
V = [1, 2, 3]
E = [[1, 2], [2, 3], [3, 1]]
RE = [[1, 3], [2, 1], [3, 2]]
G = dirgraph([1, 2, 3], [[1, 2], [2, 3], [3, 1]])
RG = dirgraph([1, 2, 3], [[1, 3], [2, 1], [3, 2]])
Yes