edgeWeights {graph}R Documentation

Retrieve the edge weights for specified indices.

Description

Obtains the weights for all edges from the nodes specified by index.

Usage

edgeWeights(object, index)

Arguments

object A graph, any object that inherits from the graph class.
index If supplied either a numeric vector or a vector of node names.

Details

If index is suppled then edge weights from these nodes to all adjacent nodes are found and returned. If index is not supplied then the edge weights for all nodes are returned.

Value

A list of named edge weight vectors. The names are index offsets into the set of nodes.

Author(s)

R. Gentleman

See Also

nodes, edges

Examples

  V <- LETTERS[1:4]
  edL2 <- vector("list", length=4)
  names(edL2) <- V
  for(i in 1:4)
    edL2[[i]] <- list(edges=c(2,1,2,1)[i], weights=sqrt(i))
  gR2 <- new("graphNEL", nodes=V, edgeL=edL2, edgemode="directed")
  edgeWeights(gR2, "C")
  edgeWeights(gR2)


[Package graph version 1.8.0 Index]