irstv/H2GIS — pull request #220 by agouge (2014-03-11 13:48:10+00:00)
Title: Add `ST_ShortestPathLength`

Calculates the distance *d(i, j)* from source vertex *i* to destination vertex
*j*. If vertex *j* is unreachable from vertex *i*, returns
`Double.POSITIVE_INFINITY`.

I have included unit tests for all eight signatures and every possible
orientation.

#### Signatures

```mysql
-- UNWEIGHTED VERSIONS
-- One-to-All
ST_ShortestPathLength('input_edges', 'o[ - eo]', s)
-- Many-to-Many
ST_ShortestPathLength('input_edges', 'o[ - eo]', 'sdt')
-- One-to-One
ST_ShortestPathLength('input_edges', 'o[ - eo]', s, d)
-- One-to-Several
ST_ShortestPathLength('input_edges', 'o[ - eo]', s, 'ds')
-- WEIGHTED VERSIONS
-- One-to-All weighted
ST_ShortestPathLength('input_edges', 'o[ - eo]', 'w', s)
-- Many-to-Many weighted
ST_ShortestPathLength('input_edges', 'o[ - eo]', 'w', 'sdt')
-- One-to-One weighted
ST_ShortestPathLength('input_edges', 'o[ - eo]', 'w', s, d)
-- One-to-Several weighted
ST_ShortestPathLength('input_edges', 'o[ - eo]', 'w', s, 'ds')
```

where
* `input_edges` = Edges table produced by `ST_Graph` from table `input`
* `o` = Global orientation (directed, reversed or undirected)
* `eo` = Edge orientation (1 = directed, -1 = reversed, 0 =
undirected). Required if global orientation is directed or reversed.
* `s` = Source vertex id
* `d` = Destination vertex id
* `sdt` = Source-Destination table name (must contain columns
SOURCE and DESTINATION containing integer vertex ids)
* `ds` = Comma-separated Destination string `'dest1, dest2, ...'`