
Last chance! 50% off unlimited learning
Sale ends in
# Loops
g <- graph( c(1,1,2,2,3,3,4,5) )
is.loop(g)
# Multiple edges
g <- barabasi.game(10, m=3, algorithm="bag")
has.multiple(g)
is.multiple(g)
count.multiple(g)
is.multiple(simplify(g))
all(count.multiple(simplify(g)) == 1)
# Direction of the edge is important
is.multiple(graph( c(1,2, 2,1) ))
is.multiple(graph( c(1,2, 2,1), dir=FALSE ))
# Remove multiple edges but keep multiplicity
g <- barabasi.game(10, m=3, algorithm="bag")
E(g)$weight <- count.multiple(g)
g <- simplify(g)
any(is.multiple(g))
E(g)$weight
Run the code above in your browser using DataLab