# strength: Vertex strength: sum of weights of incident edges In simplegraph: Simple Graph Data Types and Basic Algorithms

## Description

This is also called weighed degree.

## Usage

 `1` ```strength(graph, mode = c("out", "in", "total", "all")) ```

## Arguments

 `graph` Input graph. `mode` Whether to consider incoming (`in`), outgoing (`out`) or all (`total`) edges.

## Details

For non-weighted graphs, the degree is returned as a fallback.

## Value

Named numeric vector.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26``` ```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) ```

### Example output

```Attaching package: 'simplegraph'

The following object is masked from 'package:base':

order

a b c d
3 4 2 0
a b c d
2 2 1 0
```

simplegraph documentation built on May 30, 2017, 8:05 a.m.