Description Usage Arguments Value Author(s) References Examples
Compute Effective Resistance
1 |
graph |
an |
pad.inf |
a logical; |
an (N\times N) matrix containing effective resistance values on edge set.
Kisung You
young_new_2016PNAS
\insertRefyoung_new_2016-1PNAS
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="")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.