pgrouting icon indicating copy to clipboard operation
pgrouting copied to clipboard

Starting edge on Chinesse Postman problem

Open cvvergara opened this issue 6 years ago • 0 comments

@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

cvvergara avatar Oct 11 '18 13:10 cvvergara