How to calculate the total resistance of this electrical circuit
Set node \$V_6=0\:\textrm{V}\$, to start. (It's convenient and you get to do this exactly once; for any node you want.) Also note that \$V_1=V_2\$, so when you are looking for edges you will need to find all edges emanating from all such shared "super" nodes. (So \$V_2\$ won't appear below.) I also notice that your smaller example has a "2" as the value for an edge, when I think you earlier said that only 0, 1, or \$\infty\$ was possible. I'll live with that, though.

So the summary here is: (1) that nodes connected by 0 are the same node and you have to find all edges emanating from the same node when setting up the equations; and, (2) that edges with \$\infty\$ can be ignored; and, (3) fractions with the special node you designate as 0 in the numerator can be dropped.

Note that \$V_5\$ is, in effect, an isolated vertex. So you won't be able to compute a voltage for it. That should be fine. Also, you make have a leaf vertex (I wouldn't know how you deal with making your graph.) The voltage there will be unknown if the edge is \$\infty\$ and will be equal to the voltage at the connected node, otherwise. I'd probably just set it equal, in such cases, and be done with it.

Finally, I won't other with the \$\Omega\$ symbol (you can assume it, if you want.) Instead, I'll use the edge notation of \$R_{23}\$, for example, to represent the indicated edge resistance. If a node is shared, I'll use \$V_{12}\$, for example, to indicate that super node. Your example set of equations is:



$$\begin{align*}
\frac{V_{12}}{R_{13}}+\frac{V_{12}}{R_{23}} + \frac{V_{12}}{R_{24}} &amp;= \frac{V_3}{R_{13}} + \frac{V_3}{R_{23}} + \frac{V_4}{R_{24}}\\\\ \frac{V_3}{R_{13}}+\frac{V_3}{R_{23}} + \frac{V_3}{R_{34}} &amp;= \frac{V_{12}}{R_{13}} + \frac{V_{12}}{R_{23}} + \frac{V_4}{R_{34}} \\ \\
\frac{V_4}{R_{24}}+\frac{V_4}{R_{34}} + \frac{V_4}{R_{46}} &amp;= \frac{V_{12}}{R_{24}} + \frac{V_3}{R_{34}}
\end{align*}$$



The above can be converted to:

$$\begin{align*}
V_{12}\cdot\frac{1}{R_{13} \vert\vert R_{23} \vert\vert R_{24}} + V_3\cdot\frac{-1}{R_{13}\vert\vert R_{23}} + V_4\cdot\frac{-1}{R_{24}} &amp;= 0\\\\  V_{12}\cdot\frac{-1}{R_{13}\vert\vert R_{23}} + V_3\cdot\frac{1}{R_{13}\vert\vert R_{23}\vert\vert R_{34}}+V_4\cdot\frac{-1}{R_{34}} &amp;= 0 \\ \\
V_{12}\cdot\frac{-1}{R_{24}} + V_3\cdot\frac{-1}{R_{34}} + V_4\cdot\frac{1}{R_{24}\vert\vert R_{34}\vert\vert R_{46}} &amp;= 0
\end{align*}$$

From the above, the symmetries should now also be obvious. (Look at the constants and their positions.) The main diagonal has unique values, but the rest have values that appear twice in easily noticed symmetric positions.



But you don't need the first equation, since you already know the value of \$V_{12}\$. So it all boils down to just the bottom two equations converted to matrix form:

$$\begin{align*}
V_3\cdot\frac{1}{R_{13}\vert\vert R_{23}\vert\vert R_{34}}+V_4\cdot\frac{-1}{R_{34}} &amp;= V_{12}\cdot\frac{1}{R_{13}\vert\vert R_{23}} \\ \\
V_3\cdot\frac{-1}{R_{34}} + V_4\cdot\frac{1}{R_{24}\vert\vert R_{34}\vert\vert R_{46}} &amp;= V_{12}\cdot\frac{1}{R_{24}}
\end{align*}$$

The above solves out in your case as \$V_3=9\frac{1}{6}\:\textrm{V}\$ and \$V_4=5\frac{5}{6}\:\textrm{V}\$.



Solved for the node voltages, you can figure out the current by simply examining all the edges leaving from your node 0 (if you pick it the way I did.) There's only one edge there, namely \$R_{46}\$, so the total resistance here is simply \$R_{total}=\frac{V_{total}}{I_{total}}=\frac{V_{12}}{\left[\frac{V_4}{R_{46}}\right]}=R_{46}\cdot\frac{V_{12}}{V_4}\$.

That works out to \$1\frac{5}{7}\:\Omega\$.



You should be able to generalize the above, as it's almost already close to automatic.