[ library(grasper) | Third Party Libraries | Reference Manual | Alphabetic Index ]

oriented_graph(+UndirectedGraph, ?DirectedGraph)

Obtains an oriented graph of a given undirected graph.
UndirectedGraph
An undirected graph.
DirectedGraph
The oriented directed graph of UndirectedGraph.

Description

Obtains an oriented graph of a given undirected graph.

Fail Conditions

Fails if UndirectedGraph is not an undirected graph variable or if UndirectedGraph can not be contrained to have DirectedGraph as an oriented graph (DirectedGraph is a directed graph variable).

Examples

?- oriented_graph(UG,DG).
No.

?- V`::[]..[1,2,3], DE`::[[3,1]]..[[1,2],[2,3],[3,1]], UE`::[]..[[1,2],[2,1],[2,3],[3,2]], dirgraph(DG,V,DE), undirgraph(UG,V,UE), oriented_graph(UG,DG).
No.

?- undirgraph(UG,[1,2,3],[[1,2],[2,1]]), oriented_graph(UG,DG), graph_labeling(DG).
UG = undirgraph([1, 2, 3], [[1, 2], [2, 1]])
DG = dirgraph([1, 2, 3], [[2, 1]])
Yes ? ;

UG = undirgraph([1, 2, 3], [[1, 2], [2, 1]])
DG = dirgraph([1, 2, 3], [[1, 2]])
Yes ? ;

UG = undirgraph([1, 2, 3], [[1, 2], [2, 1]])
DG = dirgraph([1, 2, 3], [[1, 2], [2, 1]])
Yes

?- V`::[]..[1,2,3], DE`::[]..[[1,2],[3,1]], UE`::[]..[[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]], dirgraph(DG,V,DE), undirgraph(UG,V,UE), oriented_graph(UG,DG), size(DG,Size), Size #> 0, graph_labeling(DG).
V = [1, 3]
DE = [[3, 1]]
UE = [[1, 3], [3, 1]]
DG = dirgraph([1, 3], [[3, 1]])
UG = undirgraph([1, 3], [[1, 3], [3, 1]])
Size = 1
Yes ? ;

V = [1, 2]
DE = [[1, 2]]
UE = [[1, 2], [2, 1]]
DG = dirgraph([1, 2], [[1, 2]])
UG = undirgraph([1, 2], [[1, 2], [2, 1]])
Size = 1
Yes ? ;

V = [1, 2, 3]
DE = [[3, 1]]
UE = [[1, 3], [3, 1]]
DG = dirgraph([1, 2, 3], [[3, 1]])
UG = undirgraph([1, 2, 3], [[1, 3], [3, 1]])
Size = 1
Yes ? ;

V = [1, 2, 3]
DE = [[1, 2]]
UE = [[1, 2], [2, 1]]
DG = dirgraph([1, 2, 3], [[1, 2]])
UG = undirgraph([1, 2, 3], [[1, 2], [2, 1]])
Size = 1
Yes ? ;

V = [1, 2, 3]
DE = [[1, 2], [3, 1]]
UE = [[1, 2], [1, 3], [2, 1], [3, 1]]
DG = dirgraph([1, 2, 3], [[1, 2], [3, 1]])
UG = undirgraph([1, 2, 3], [[1, 2], [1, 3], [2, 1], [3, 1]])
Size = 2
Yes