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

Added queries in doc of line Graph for undirected graph #904

Merged
merged 1 commit into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions doc/lineGraph/pgr_lineGraph.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ Given a graph G, its line graph L(G) is a graph such that:-
- two vertices of L(G) are adjacent if and only if their corresponding edges
share a common endpoint in G.

The current implementation only works for the `directed graph`.


The following figures show a graph (left, with blue vertices) and its
Line Graph (right, with green vertices).

Expand Down
91 changes: 30 additions & 61 deletions doc/queries/doc-pgr_lineGraph.queries
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
-BEGIN;
-BEGIN
--- q1
-SELECT * FROM edge_table1;
-SELECT * FROM edge_table;
- ID | source | target | cost | reverse_cost
-----+--------+--------+------+--------------
- 1 | 1 | 2 | 1 | 1
- 2 | 2 | 3 | -1 | 1
- 3 | 3 | 4 | -1 | 1
- 4 | 2 | 5 | 1 | 1
-(4 rows)
-
-SELECT * FROM pgr_lineGraph(
- 'SELECT id, source, target, cost, reverse_cost FROM edge_table1'
- 'SELECT id, source, target, cost, reverse_cost FROM edge_table'
-);
- seq | source | target | cost | reverse_cost
------+--------+--------+------+--------------
Expand All @@ -19,80 +20,48 @@
- 3 | -2 | -1 | 1 | -1
- 4 | -2 | 4 | 1 | -1
-(4 rows)
-
--- q2
-SELECT * FROM edge_table2;
-SELECT * FROM edge_table;
- ID | source | target | cost | reverse_cost
-----+--------+--------+------+--------------
- 1 | 1 | 2 | 10 | -1
- 2 | 2 | 1 | 25 | -1
- 3 | 2 | 3 | 20 | 25
- 1 | 1 | 2 | 1 | 1
- 2 | 2 | 3 | -1 | 1
- 3 | 3 | 4 | -1 | 1
-(3 rows)
-
-SELECT * FROM pgr_lineGraph(
- 'SELECT id, source, target, cost, reverse_cost FROM edge_table2',
- true
- 'SELECT id, source, target, cost, reverse_cost FROM edge_table',
- FALSE
-);
- seq | source | target | cost | reverse_cost
------+--------+--------+------+--------------
- 1 | -3 | 2 | 1 | -1
- 2 | 1 | 3 | 1 | -1
- 3 | 2 | 1 | 1 | 1
-(3 rows)
- 1 | -2 | -1 | 1 | -1
- 2 | -2 | 1 | 1 | -1
- 3 | 1 | -2 | 1 | -1
- 4 | -1 | -2 | 1 | -1
- 5 | -3 | -2 | 1 | -1
- 6 | -2 | -3 | 1 | -1
-(6 rows)
-
--- q3
-SELECT * FROM edge_table3;
-SELECT * FROM edge_table;
- ID | source | target | cost | reverse_cost
-----+--------+--------+------+--------------
- 1 | 1 | 2 | 1 | 1
- 2 | 2 | 3 | -1 | 1
- 3 | 3 | 4 | -1 | 1
- 4 | 2 | 5 | 1 | 1
- 5 | 3 | 6 | 1 | -1
- 6 | 7 | 8 | 1 | 1
- 7 | 8 | 5 | 1 | 1
- 8 | 5 | 6 | 1 | 1
- 9 | 6 | 9 | 1 | 1
- 10 | 5 | 10 | 1 | 1
- 11 | 6 | 11 | 1 | -1
- 12 | 10 | 11 | 1 | -1
- 13 | 11 | 12 | 1 | -1
- 14 | 10 | 13 | 1 | 1
- 15 | 9 | 12 | 1 | 1
- 16 | 4 | 9 | 1 | 1
- 17 | 14 | 15 | 1 | 1
- 18 | 16 | 17 | 1 | 1
- 1 | 1 | 2 | 10 | -1
- 2 | 2 | 1 | 25 | -1
- 3 | 2 | 3 | 20 | 25
-(3 rows)
-
-SELECT * FROM pgr_lineGraph(
- 'SELECT id, source, target, cost, reverse_cost FROM edge_table3'
- 'SELECT id, source, target, cost, reverse_cost FROM edge_table'
-);
- seq | source | target | cost | reverse_cost
------+--------+--------+------+--------------
- 1 | -16 | -3 | 1 | -1
- 2 | -15 | -9 | 1 | 1
- 3 | -14 | -10 | 1 | 1
- 4 | -14 | 12 | 1 | -1
- 5 | -10 | -7 | 1 | 1
- 6 | -10 | -4 | 1 | 1
- 7 | -10 | 8 | 1 | 1
- 8 | -9 | -8 | 1 | 1
- 9 | -9 | 11 | 1 | -1
- 10 | -8 | -7 | 1 | 1
- 11 | -8 | -4 | 1 | 1
- 12 | -7 | -6 | 1 | 1
- 13 | -4 | -1 | 1 | 1
- 14 | -3 | -2 | 1 | -1
- 15 | -3 | 5 | 1 | -1
- 16 | -2 | -1 | 1 | -1
- 17 | -2 | 4 | 1 | -1
- 18 | 5 | -8 | 1 | -1
- 19 | 5 | 9 | 1 | -1
- 20 | 5 | 11 | 1 | -1
- 21 | 7 | -4 | 1 | 1
- 22 | 8 | 11 | 1 | -1
- 23 | 10 | 12 | 1 | -1
- 24 | 11 | 13 | 1 | -1
- 25 | 12 | 13 | 1 | -1
- 26 | 13 | -15 | 1 | -1
- 27 | 16 | -9 | 1 | 1
- 28 | 16 | 15 | 1 | 1
-(28 rows)
- 1 | -3 | 2 | 1 | -1
- 2 | 1 | 3 | 1 | -1
- 3 | 2 | 1 | 1 | 1
-(3 rows)
-
--- q4
-ROLLBACK;
Expand Down