[ library(grasper) | Reference Manual | Alphabetic Index ]
# connected(+Graph)

Guarantees that an undirected graph Graph is connected.
*Graph*
- A graph.

## Description

Guarantees that an undirected graph Graph is connected, i.e., that each vertex is reachable from any other one.
### Fail Conditions

Fails
if Graph is not an undirected graph variable or
if Graph can not be constrained to be connected.
## Examples

?- connected(G).
No.
?- V`::[1,2]..[1,2,3,4], E`::[]..[[1,3],[2,4],[3,1],[4,2]], undirgraph(G,V,E), connected(G).
No.
?- V`::[1,2]..[1,2,3], E`::[]..[[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]], undirgraph(G,V,E), connected(G), graph_labeling(G).
V = [1, 2]
E = [[1, 2], [2, 1]]
G = undirgraph([1, 2], [[1, 2], [2, 1]])
Yes ? ;
V = [1, 2, 3]
E = [[1, 3], [2, 3], [3, 1], [3, 2]]
G = undirgraph([1, 2, 3], [[1, 3], [2, 3], [3, 1], [3, 2]])
Yes ? ;
V = [1, 2, 3]
E = [[1, 2], [2, 1], [2, 3], [3, 2]]
G = undirgraph([1, 2, 3], [[1, 2], [2, 1], [2, 3], [3, 2]])
Yes ? ;
V = [1, 2, 3]
E = [[1, 2], [1, 3], [2, 1], [3, 1]]
G = undirgraph([1, 2, 3], [[1, 2], [1, 3], [2, 1], [3, 1]])
Yes ? ;
V = [1, 2, 3]
E = [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]]
G = undirgraph([1, 2, 3], [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]])
Yes