The function setEdges
allows one to add or remove edges in a
gGraph by directly specifying the relevant nodes, as a list or
a data.frame. This low-level function is called by geo.add.edges
and
geo.remove.edges
.
Usage
setEdges(x, ...)
# S4 method for gGraph
setEdges(x, add = NULL, remove = NULL, costs = NULL, ...)
Arguments
- x
a valid gGraph object.
- ...
other arguments passed to other methods (currently unused).
- add
a list or a dataframe containing node names of edges to be added. The first element of the list (or column of the data.frame) gives starting nodes of edges; the second gives ending nodes. Hence, the nodes of the i-th edge are
add[[1]][i]
andadd[[2]][i]
ifadd
is a list, andadd[i,]
ifadd
is a data.frame.- remove
same as
add
argument, but edges are removed.- costs
a numeric vector providing costs of the edges to be added.
costs[i]
is the weight of the i-th edge.
Value
A gGraph object with newly added or removed edges.
See also
geo.add.edges
and geo.remove.edges
to
interactively add or remove edges in a gGraph object.
getEdges
to retrieve edges in different formats.