checkGraph: 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.
vector containing the nodes of the graph,
identified by a number that goes from $1$ to the
order of the graph.
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 (TRUE) or not (FALSE).
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.