Looking for how to go from graph theory directly to solve circuit/nodal analysis. This link has been helpful: (have to google graphsandckts.pdf because I can't post the link) but I seem to be getting lost in the graph theory part. Circuit analysis software like SPICE must do something like this numerically.
I can build a directed graph in Sagemath by adding vertices/edges.
Sagemath will return the incidence matrix. Or you can enter the incidence matrix directly but for something like a circuit 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.
The rest should be basic linear algebra: transpose, inverse, multiplying it out