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

# weakly_connected(+Graph)

Guarantees that a directed graph Graph is weakly connected.

Graph
  A graph.

## Description

Guarantees that a directed graph Graph is weakly connected, i.e., that each vertex is reachable from any other one in the underlying graph of Graph.

### Fail Conditions

Fails if Graph is not a directed graph variable or if Graph can not be constrained to be strongly connected.

## Examples

    ?- weakly_connected(G).
    No.

    ?- V`::[1,2]..[1,2,3,4], E`::[]..[[1,3],[2,4],[3,1],[4,2]], dirgraph(G,V,E), weakly_connected(G).
    No.

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

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

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

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

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

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

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