I use driving_distance function in pgRouting to work with my river network. There are 159 nodes in my river network, and I want to get the distance between all of the nodes. This is my code so far：
SELECT * FROM driving_distance(' SELECT gid as id, target::int4 AS source, source::int4 AS target, shape_leng::double precision as cost, rcost::double precision as reverse_cost FROM network', 3, 10000000, true, true);
And as I want to get the other distance matrix starting from another starting node(in the case above, the starting node is 3), I need to change the node id everytime.
How can I use for loop or something else to get the distance matrix more efficiently？