edgeWeights {graph} | R Documentation |
Obtains the weights for all edges from the nodes specified by
index
.
edgeWeights(object, index)
object |
A graph, any object that inherits from the graph
class. |
index |
If supplied either a numeric vector or a vector of node names. |
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.
A list of named edge weight vectors. The names are index offsets into the set of nodes.
R. Gentleman
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)