I'm working with Oracle 10.
I have data that describes the nodes and paths of a graph. I'd like to build a query that describes all the routes between endpoints and their value or cost of traversal.
Example data :
NodeId1 NodeId2 Endpoint1 Endpoint2 Value
1170 8406 34210 (null) 39
8411 8410 (null) 34260 1
8411 4275 (null) 32231 60
8406 8405 (null) 34287 1
8406 8411 (null) (null) 26
This describes a graph looking like this (costs are in parenthesis, endpoints are square brackets):
1170 8406 8405
[]-----------------o----------------[]
(39) | (1)
|
|(27)
| 4275
8411 o----------------[]
| (60)
|
(1)|
|
[]
8410
The output should look like:
Start End Cost
1170 4275 126
1170 8405 40
1170 8410 67
8405 4275 88
8405 8410 29
4275 8410 61
I don't really need to have the output work both ways (1170 to 8406 AND 8406 to 1170) but it could help in further use of the result so if it's possible to include, it would be nice.