library(rbenchmark)
library(igraph)
library(sna)
## sna: Tools for Social Network Analysis
## Version 2.3-2 created on 2014-01-13.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##  For citation information, type citation("sna").
##  Type help(package="sna") to get started.
## 
## 
## Attaching package: 'sna'
## 
## The following objects are masked from 'package:igraph':
## 
##     betweenness, bonpow, %c%, closeness, degree, dyad.census,
##     evcent, hierarchy, is.connected, neighborhood, triad.census
igraph.graph <- igraph::watts.strogatz.game(1, 100, 5, 0.05)
sna.graph <- as.matrix(igraph::get.adjacency(igraph.graph))

plot(igraph.graph, vertex.size = 4, vertex.label = NA)

benchmark(sna::betweenness(sna.graph), 
          igraph::betweenness(igraph.graph))
##                                test replications elapsed relative
## 2 igraph::betweenness(igraph.graph)          100   0.120    1.000
## 1       sna::betweenness(sna.graph)          100   0.703    5.858
##   user.self sys.self user.child sys.child
## 2     0.120    0.000          0         0
## 1     0.699    0.004          0         0
benchmark(x <- sna::geodist(sna.graph),
          x <- igraph::shortest.paths(igraph.graph))
##                                        test replications elapsed relative
## 2 x <- igraph::shortest.paths(igraph.graph)          100   0.144    1.000
## 1              x <- sna::geodist(sna.graph)          100   0.561    3.896
##   user.self sys.self user.child sys.child
## 2     0.139    0.004          0         0
## 1     0.557    0.004          0         0