* A non-zero value at entry (i,j) in an adjacency matrix A for a
graph means that there is an edge from i to j. If also (j,i) is
non-zero there is also an edge from j to i. In this case we may
think of a bidirected edge between i and j or we may think of the
edge as being undirected. We do not distinguish between undirected
and bidirected edges in the gRbase package. On the other hand,
graphNEL objects from the graph package makes such a distinction
(the function edgemode()
will tell if edges are "directed"
or "undirected" in a graphNEL object).
* The function is_ug()
checks if the adjacency matrix is
symmetric (If applied to a graphNEL, the adjacency matrix is
created and checked for symmetry.)
* The function is_tug()
checks if the graph is undirected and
triangulated (also called chordal) by checking if the adjacency matrix is
symmetric and the vertices can be given a perfect ordering using maximum
cardinality seach.
* The function is_dg()
checks if a graph is directed, i.e., that there
are no undirected edges. This is done by computing the elementwise product
of A and the transpose of A; if there are no non--zero entries in this
product then the graph is directed.
* The function is_dag()
will return TRUE
if all edges are
directed and if there are no cycles in the graph. (This is checked by
checking if the vertices in the graph can be given a topological ordering
which is based on identifying an undirected edge with a bidrected edge).
* There is a special case, namely if the graph has no edges at all (such that
the adjacency matrix consists only of zeros). Such a graph is both
undirected, triangulated, directed and directed acyclic.