I have a table representing a graph: Edges (from, to) .
I would like to query this table using "path queries", getting only the source and destination of the path.
For example, suppose my table consists of the following rows:
+------+----+
| from | to |
+------+----+
| a | b |
| b | c |
| c | d |
| f | g |
| b | f |
| c | a |
+------+----+
Suppose I execute the following (pseudo) query:
SELECT ?v1, ?v2 WHERE ?v1 to ?t1, ?t1 to ?t2, ?t2 to ?v2;
This means that I want all source and destination pairs to exist in all 4-node paths. Executing this query should return the following results:
+-----+-----+
| ?v1 | ?v2 |
+-----+-----+
| a | a |
| a | g |
| a | d |
+-----+-----+
Of course, paths consisting of a different number of nodes may be needed, number 4 is not hard-coded :-)
My questions:
- SQL- ( , SQLite, ).
- . ? , ? ?
!