Compute resistance of linear electrical circuits