weighted edge in degree calculation

Hi, I want to know in a directed network, how igraph handles weighted edges when counting in-, out-, and total degrees?

Note that:

  • degree() calculates the number of neighbours for each selected vertex.
  • strength() sums the edge weights of the adjacent edges for each selected vertex.
library(igraph)
g <- graph_from_literal(1-+2:3:4:5)
g
E(g)$weight <- 2
degree(g, mode="out")
strength(g, mode="out")
help(degree)       # see doc
help(strength)     # see doc

Output:

IGRAPH 46548af DNW- 5 4 -- 
+ attr: name (v/c), weight (e/n)
+ edges from 46548af (vertex names):
[1] 1->2 1->3 1->4 1->5

degrees:
1 2 3 4 5   
4 0 0 0 0 

strength
1 2 3 4 5 
8 0 0 0 0
1 Like