|
ResistanceMatrix[g_Graph] := With[{n = VertexCount[g], km = KirchhoffMatrix[g]},
|
|
Table[ ReplacePart[ Diagonal[ DrazinInverse[ ReplacePart[km, k -> UnitVector[n, k]]]], k -> 0],
|
|
{k, n}]
|
|
]
|
|
|
|
rm = ResistanceMatrix[GridGraph[{10, 10}]];
|
|
|
|
N[rm[[12, 68]], 40]
|