I write a solution in C++.
here is the link: https://khobaib529.medium.com/solving-electrical-circuits-a-graph-based-algorithm-for-resistance-calculations-921575c59946