Looking for how to go from graph theory directly to solve circuit/nodal analysis. This link has been helpful: graphs and circuits but I seem to be getting lost in the graph theory part. SPICE must do something like this numerically, is there any documentation on the design/algorithms that SPICE uses?
I can build a directed graph in Sagemath/Mathematica by adding vertices/edges.
Sagemath will return the incidence matrix. Or you can enter the incidence matrix directly but for something like a netlist it can be a lot easier to enter nodes, ie. vertices of the graph.
Resistances/impedances go into a diagonal matrix R, known voltages/currents go into a vector.
I'm not clear on finding the spanning tree/re-arranging the incidence matrix. Seems like this should be some standard graph theory or linear algebra functions. You eliminate one row/column and should have a matrix A =[ At I ] where At = edges in the graph spanning tree and I = n x n identity matrix.