effective: Compute Effective Resistance

Description Usage Arguments Value Author(s) References Examples

View source: R/effective.R

Description

Compute Effective Resistance

Usage

1
effective(graph, pad.inf = FALSE)

Arguments

graph

an igraph object or (N\times N) adjacency matrix.

pad.inf

a logical; TRUE to take extremely large values as Inf, FALSE otherwise.

Value

an (N\times N) matrix containing effective resistance values on edge set.

Author(s)

Kisung You

References

\insertRef

young_new_2016PNAS

\insertRef

young_new_2016-1PNAS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## create a graph with disconnected and singleton components, adapted from 
#  https://stackoverflow.com/questions/29730624/how-to-split-an-igraph-into-connected-subgraphs
library(igraph)
g <- simplify(
     graph.compose(graph.ring(10), 
                   graph.star(5, mode = "undirected"))
             ) + edge("7","8")
             
# compute effective resistance
ermat = effective(g)

# visualize
par(mfrow=c(1,2),pty="s")
plot(g, main="the graph 'g'")
image(ermat[,10:1],col=gray(0:32/32),
      main="white for Inf values",xlab="",ylab="")

kyoustat/PNAS documentation built on Nov. 14, 2019, 4:09 p.m.