Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]Implementation of pgr_prim #1035

Merged
merged 8 commits into from
May 27, 2018
Merged

Conversation

apslight
Copy link
Contributor

@apslight apslight commented May 24, 2018

Include - Add header file

  • Create pgr_prim.hpp
  • Create pgr_primGraph.hpp
  • Create pgr_prim_t.h
  • Fix pgr_prim.hpp

@apslight apslight changed the title Implementation of pgr_prim [WIP]Implementation of pgr_prim May 24, 2018
@apslight
Copy link
Contributor Author

apslight commented May 27, 2018

Input data used in proposal : link can be found here.

CREATE TABLE sample (
                id BIGSERIAL,
                source BIGINT,
                target BIGINT,
                cost FLOAT,
                reverse_cost FLOAT);

INSERT INTO sample (
              source, target,
              cost, reverse_cost )
 VALUES
( 1, 2, 8, 8), ( 1, 6, 10, 10), ( 1, 8, 4, 4), ( 2, 6, 7, 7), ( 2, 8, 9, 9), ( 2, 3, 4, 4), ( 2, 5, 10, 10),
( 3, 6, 3, 3), ( 3, 4, 3, 3), ( 4, 6, 18, 18), ( 4, 5, 25, 25), ( 4, 7, 2, 2), ( 5, 7, 7, 7), ( 5, 6, 2, 2), 
( 7, 8, 3, 3);                               


SELECT * FROM pgr_prim(
    'SELECT id, source, target, cost, reverse_cost FROM sample');

Output: link of c++ output

 seq | start_node | end_node | edge | cost | agg_cost 
-----+------------+----------+------+------+----------
   1 |          1 |       -1 |   -1 |    0 |        0
   2 |          2 |        3 |    6 |    4 |        4
   3 |          6 |        3 |    8 |    3 |        7
   4 |          8 |        1 |    3 |    4 |       11
   5 |          3 |        4 |    9 |    3 |       14
   6 |          5 |        6 |   14 |    2 |       16
   7 |          4 |        7 |   12 |    2 |       18
   8 |          7 |        8 |   15 |    3 |       21
(8 rows)

@apslight
Copy link
Contributor Author

Sample data : link can be found here.
Output for Sample Data: link of c++ output

 seq | start_node | end_node | edge | cost | agg_cost 
-----+------------+----------+------+------+----------
   1 |          1 |       -1 |   -1 |    0 |        0
   2 |          2 |        1 |    1 |    1 |        1
   3 |          3 |        2 |    2 |    1 |        2
   4 |          4 |        3 |    3 |    1 |        3
   5 |          5 |        2 |    4 |    1 |        4
   6 |          6 |        3 |    5 |    1 |        5
   7 |          7 |        8 |    6 |    1 |        6
   8 |          8 |        5 |    7 |    1 |        7
   9 |          9 |        6 |    9 |    1 |        8
  10 |         10 |        5 |   10 |    1 |        9
  11 |         11 |        6 |   11 |    1 |       10
  12 |         12 |       11 |   13 |    1 |       11
  13 |         13 |       10 |   14 |    1 |       12
  14 |         14 |       -1 |   -1 |    0 |       12
  15 |         15 |       -1 |   -1 |    0 |       12
  16 |         16 |       -1 |   -1 |    0 |       12
  17 |         17 |       -1 |   -1 |    0 |       12
(17 rows)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants