I have the exact same problem as explain in this post. I'm trying to find the shortest path between each building on a map (shp multipolygon) to any transformation plant (shp multipoints) by following a network (shp multipolyline).
As suggested in the answer given to the OP, I was thinking of using pgr_dijkstra() but I think it won't work. The thing is, if I'm not mistaken, pgr_dijkstra() return the shortest path between 2 points. In this case, we do not know which electric transformation plan we're looking to reach, the goal is to find the shortest path to any transformation plant on the network.
In order to use pgr_dijkstra(), we would have to first assign an electric transformation plant to each building (minimum radial distance around it for example) but there could be situations in which the closest transformation plant in radial distance is not at all the closest by the network.
Does anyone knows if there is a way, with pgRouting or something else, to find the shortest path to any of the electrical transformation plant on the network (I've already managed to connect each building to the closest line on the network in order to be able to look for the shortest path between points which already are on the network, cf. this post).