strength {simplegraph} | R Documentation |
Vertex strength: sum of weights of incident edges
Description
This is also called weighed degree.
Usage
strength(graph, mode = c("out", "in", "total", "all"))
Arguments
graph |
Input graph. |
mode |
Whether to consider incoming ( |
Details
For non-weighted graphs, the degree is returned as a fallback.
Value
Named numeric vector.
Examples
G <- graph(
data.frame(
stringsAsFactors = FALSE,
id = c("a", "b", "c", "d")
),
data.frame(
stringsAsFactors = FALSE,
from = c("a", "a", "b", "b", "c"),
to = c("b", "d", "d", "c", "a"),
weight = c( 1 , 2 , 1 , 3 , 2 )
)
)
strength(G)
G2 <- graph(
data.frame(
stringsAsFactors = FALSE,
id = c("a", "b", "c", "d")
),
data.frame(
stringsAsFactors = FALSE,
from = c("a", "a", "b", "b", "c"),
to = c("b", "d", "d", "c", "a")
)
)
strength(G2)
[Package simplegraph version 1.0.1 Index]