pgrouting
pgrouting copied to clipboard
Starting edge on Chinesse Postman problem
@XJTUmg
Is it possible to add to the Chinese postman problem a start_eid (start edge id) so that the first line of the result is that edge?
SELECT * FROM pgr_directedChPP(
'SELECT id,
source, target,
cost, reverse_cost FROM edge_table where id < 17'
);
seq | node | edge | cost | agg_cost
-----+------+------+------+----------
1 | 4 | 3 | 1 | 0
2 | 3 | 2 | 1 | 1
3 | 2 | 1 | 1 | 2
4 | 1 | 1 | 1 | 3
etc
have
SELECT * FROM pgr_directedChPP(
'SELECT id,
source, target,
cost, reverse_cost FROM edge_table where id < 17',
2 -- the first edge to be on the list is edge 2
);
seq | node | edge | cost | agg_cost
-----+------+------+------+----------
1 | 3 | 2 | 1 | 1
2 | 2 | 1 | 1 | 2
3 | 1 | 1 | 1 | 3
etc