# Article: xkcd Resistor Network

Back to Articles Index

A bit of fun, this time. You may've seen this whimsical diagram before. That jumble of resistors?

## Analysis

First, we label the nodes. These are assigned roughly in rows, left to right, top to bottom. Note that nodes 5 and 10 are really the same thing, so we'll join them with an inconsequential value resistor. Drawn up, with designators assigned to the resistors, and rearranged with square lines and even spacing, gives this schematic: xkcd Resistor Network.SchDoc There is also an inconsequential resistor to GND, because SPICE requires a ground reference node.

Some features of the overall structure are apparent:

• There are no exclusively series or parallel resistors, so there are no "trivial" optimizations.
• There are at least six delta (or pi) networks: triangles of resistors that cannot be reduced, in and of themselves. These are: 1-2-5, 1-3-6, 4-7-8, 3-6-12, 9-10-13 and 10-11-14. A delta network can be transformed to a wye (or T) network, and usually in one way or another, series or parallel resistors can be found, so that further reduction becomes possible. (I don't know offhand if these three rules are sufficient to solve any network, or if there is no general graphical (i.e., non-matrix) solution for finite networks.)
• Interestingly, there is a combination of both delta and wye: the triangle 4-7-8 is 'suspended' between the nodes 2-6-13 with one resistor per connection, so it can be simplified to a single wye/delta network very easily (transform the inner delta to wye, simplify the series resistors).
• Nodes 5 and 10 (again, they're really the same node) have the most connections: eight resistors! (R13 doesn't count.) Most nodes have counts of 3 and 4.
• If you set up the equations for nodal analysis, you get a 13x13 matrix (I think?). The matrix is relatively sparse (mostly zeroes), so it should be pretty easy to reduce and diagonalize, such as by applying Gauss-Jordan elimination.
• I'm not going to do this busy work by hand, but I'm quite happy to let a computer do it!

To run the simulation, open the schematic in Altium Designer (or—I'm not intimately familiar with the free Circuit Studio, but I understand it can import AD files, and if they left the simulator in, this should all go pretty much the same). In the menus, select: Design - Simulate - Mixed Sim (keyboard shortcut D, S, S). This opens the simulation dialog. Under General Setup, select "V1#branch" from the Available Signals list. Press ">" to push it over to the Active Signals list. Enable the Operating Point Analysis and disable other analyses. (Custom parameters under Advanced Options will not be necessary here.) Press OK. This should pop up: 1.337A flows out from the source (hence, negative). The source is 1.0V, therefore the load resistance is 1 / 1.337 = 0.7479Ω. About three-quarters of an ohm.

But a numerical solution is always so unsatisfying (especially one that's only as accurate as a slide rule, or as building it physically!). Wouldn't it be cool to get the exact value (a rational number)? There's a certain magic about this: the structure (down to symmetries) uniquely defines the pattern of digits, the prime factors, all sorts of cool number-theoretic properties of the result. An infinite network can even have irrational or transcendental values!

There is a wonderful calculator: Resistor Network Solver by Kirill Kryukov. You enter a simplified netlist, and not only does it solve it numerically, but it does so with "infinite" precision (showing the rational result). And you get a graph showing the nodes, and resistances linking them! (Notice I'm late to the party: this network is already provided as an example!)

The netlist format is weird, unfortunately: you name the nodes alphabetically, and the resistances (numerical) between node names. You can keep going, by extending the statement with another branch to another node, or starting over by entering another node. So, as far as I know, "a 1 b 1 c" is equivalent to "a 1 b / b 1 c" (indicating an optional newline with '/'; white space is simply collapsed together). Curiously, the graph drawing engine parses these differently, putting nodes and edges in different positions, but still drawing the same graph.

It should be sufficient to convert SPICE netlists into this format by: 1. stripping the designator and any model information, 2. renaming any numerically named nodes to an alphanumeric name (numerical net names can't be disambiguated as net or value), 3. moving the value parameter inbetween the node names, and 4. converting fractional suffixes (m, u, n, p, f) to decimal (1m → 0.001) or fraction (1u → 1/1000000) format. (Multiplicative suffixes are okay: k = 1000, m = 1000000, etc.) (Note that, since the computation is rational, there is no loss of accuracy with fractional inputs!)

Interestingly, his example also shows the "big node" split: nodes o (my 5) and l (my 10) are connected with a 0-ohm jumper.

Back to Articles Index