getEdges | R Documentation |
Returns the edges of a graph (or edges not in a graph) where the graph can be either an igraph object, a list of generators or an adjacency matrix.
getEdges(object, type = "unrestricted", ingraph = TRUE, discrete = NULL, ...)
object |
An object representing a graph; either a generator list, an igraph object or an adjacency matrix. |
type |
Either "unrestricted" or "decomposable" |
ingraph |
If TRUE the result is the edges in the graph; if FALSE the result is the edges not in the graph. |
discrete |
This argument is relevant only if |
... |
Additional arguments; currently not used. |
When ingraph=TRUE
: If type="decomposable" then
getEdges()
returns those edges e for which the graph with e
removed is decomposable.
When ingraph=FALSE
: Likewise, if type="decomposable" then
getEdges()
returns those edges e for which the graph with e added is
decomposable.
The functions getInEdges()
and getInEdges()
are just wrappers
for calls to getEdges()
.
The workhorses are getInEdgesMAT()
and getOutEdgesMAT()
and
these work on adjacency matrices.
Regarding the argument discrete
, please see the documentation of
mcs_marked
.
A p * 2 matrix with edges.
These functions work on undirected graphs. The behaviour is undocumented for directed graphs.
Søren Højsgaard, sorenh@math.aau.dk
edgeList
, nonEdgeList
.
gg <- ug(~a:b:d + a:c:d + c:e, result="igraph")
glist <- getCliques(gg)
adjmat <- as(gg, "matrix")
#### On a glist
getEdges(glist)
getEdges(glist, type="decomposable")
# Deleting (a,d) would create a 4-cycle
getEdges(glist, ingraph=FALSE)
getEdges(glist, type="decomposable", ingraph=FALSE)
# Adding (e,b) would create a 4-cycle
#### On a graphNEL
getEdges(gg)
getEdges(gg, type="decomposable")
# Deleting (a,d) would create a 4-cycle
getEdges(gg, ingraph=FALSE)
getEdges(gg, type="decomposable", ingraph=FALSE)
# Adding (e,b) would create a 4-cycle
#### On an adjacency matrix
getEdges(adjmat)
getEdges(adjmat, type="decomposable")
# Deleting (a,d) would create a 4-cycle
getEdges(adjmat, ingraph=FALSE)
getEdges(adjmat, type="decomposable", ingraph=FALSE)
# Adding (e,b) would create a 4-cycle
## Marked graphs; vertices a,b are discrete; c,d are continuous
UG <- ug(~a:b:c + b:c:d, result="igraph")
disc <- c("a", "b")
getEdges(UG)
getEdges(UG, discrete=disc)
## Above: same results; there are 5 edges in the graph
getEdges(UG, type="decomposable")
## Above: 4 edges can be removed and will give a decomposable graph
##(only removing the edge (b,c) would give a non-decomposable model)
getEdges(UG, type="decomposable", discrete=c("a","b"))
## Above: 3 edges can be removed and will give a strongly decomposable
## graph. Removing (b,c) would create a 4--cycle and removing (a,b)
## would create a forbidden path; a path with only continuous vertices
## between two discrete vertices.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.