# Checks if the graph contains at least one tree or one arborescence

### Description

The `checkGraph`

function checks if it is possible to
find at least one tree (or arborescence, if it is the case)
in the graph. It only happens when the graph is connected
and it is posible to find a walk from the source to any
other node.

### Usage

1 | ```
checkGraph(nodes, arcs, source.node = 1, directed = TRUE)
``` |

### Arguments

`nodes` |
vector containing the nodes of the graph,
identified by a number that goes from |

`arcs` |
matrix with the list of arcs of the graph. Each row represents one arc. The first two columns contain the two endpoints of each arc and the third column contains their weights. |

`source.node` |
number pointing the source node of the graph. |

`directed` |
logical value indicating whether the
graph is directed ( |

### Value

`checkGraph`

returns the value `TRUE`

if the
graph meets the requirements and `FALSE`

otherwise. If
the graph is not acceptable this functions also prints the
reason.

### Examples

1 2 3 4 5 6 | ```
# Graph
nodes <- 1:4
arcs <- matrix(c(1,2,2, 1,3,15, 2,3,1, 2,4,9, 3,4,1),
byrow = TRUE, ncol = 3)
# Check graph
checkGraph(nodes, arcs)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.