setEdges: Add and remove edges from a gGraph object

setEdgesR Documentation

Add and remove edges from a gGraph object

Description

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 signature '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] and add[[2]][i] if add is a list, and add[i,] if add 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.

Functions

  • setEdges(gGraph): Method for gGraph object

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.


thibautjombart/geograph documentation built on Jan. 27, 2024, 10 p.m.