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

underlying_graph(+DirectedGraph, ?UndirectedGraph)

Obtains an underlying graph of a given directed graph.
DirectedGraph
A directed graph.
UndirectedGraph
The underlying undirected graph of DirectedGraph.

Description

Obtains an underlying graph of a given directed graph.

Fail Conditions

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

Examples

?- underlying_graph(DG,UG).
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), underlying_graph(DG,UG).
No.

?- V`::[]..[1,2,3], DE`::[[3,1]]..[[1,2],[2,3],[3,1]], dirgraph(DG,V,DE), underlying_graph(DG,UG), graph_labeling(DG).
V = [1, 3]
DE = [[3, 1]]
DG = dirgraph([1, 3], [[3, 1]])
UG = undirgraph([1, 3], [[1, 3], [3, 1]])
Yes ? ;

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

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

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

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

?- V`::[]..[1,2,3], DE`::[]..[[1,2],[2,3],[3,1]], UE`::[]..[[1,2],[2,1],[2,3],[3,2]], dirgraph(DG,V,DE), undirgraph(UG,V,UE), underlying_graph(DG,UG), size(DG,Size), Size #> 0, graph_labeling(DG).
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 = [[2, 3]]
UE = [[2, 3], [3, 2]]
DG = dirgraph([1, 2, 3], [[2, 3]])
UG = undirgraph([1, 2, 3], [[2, 3], [3, 2]])
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], [2, 3]]
UE = [[1, 2], [2, 1], [2, 3], [3, 2]]
DG = dirgraph([1, 2, 3], [[1, 2], [2, 3]])
UG = undirgraph([1, 2, 3], [[1, 2], [2, 1], [2, 3], [3, 2]])
Size = 2
Yes