Driving Distance - Category

Proposed

Warning

Proposed functions for next mayor release.

  • They are not officially in the current release.

  • They will likely officially be part of the next mayor release:

    • The functions make use of ANY-INTEGER and ANY-NUMERICAL

    • Name might not change. (But still can)

    • Signature might not change. (But still can)

    • Functionality might not change. (But still can)

    • pgTap tests have being done. But might need more.

    • Documentation might need refinement.

Calculate nodes that are within a distance.

  • Extracts all the nodes that have costs less than or equal to the value distance.

  • The edges extracted will conform to the corresponding spanning tree.

  • Edge \((u, v)\) will not be included when:

    • The distance from the root to \(u\) > limit distance.

    • The distance from the root to \(v\) > limit distance.

    • No new nodes are created on the graph, so when is within the limit and is not within the limit, the edge is not included.

Parameters

Parameter

Type

Description

Edges SQL

TEXT

Edges SQL as described below.

Root vid

BIGINT

Identifier of the root vertex of the tree.

Root vids

ARRAY[ANY-INTEGER]

Array of identifiers of the root vertices.

  • \(0\) values are ignored

  • For optimization purposes, any duplicated value is ignored.

distance

FLOAT

Upper limit for the inclusion of a node in the result.

Where:

ANY-NUMERIC:

SMALLINT, INTEGER, BIGINT, REAL, FLOAT

Inner Queries

Edges SQL

Column

Type

Default

Description

id

ANY-INTEGER

Identifier of the edge.

source

ANY-INTEGER

Identifier of the first end point vertex of the edge.

target

ANY-INTEGER

Identifier of the second end point vertex of the edge.

cost

ANY-NUMERICAL

Weight of the edge (source, target)

reverse_cost

ANY-NUMERICAL

-1

Weight of the edge (target, source)

  • When negative: edge (target, source) does not exist, therefore it’s not part of the graph.

Where:

ANY-INTEGER:

SMALLINT, INTEGER, BIGINT

ANY-NUMERICAL:

SMALLINT, INTEGER, BIGINT, REAL, FLOAT

Result columns

Returns set of (seq, depth, start_vid, pred, node, edge, cost, agg_cost)

Parameter

Type

Description

seq

BIGINT

Sequential value starting from \(1\).

depth

BIGINT

Depth of the node.

  • \(0\) when node = start_vid.

  • \(depth-1\) is the depth of pred

start_vid

BIGINT

Identifier of the root vertex.

pred

BIGINT

Predecessor of node.

  • When node = start_vid then has the value node.

node

BIGINT

Identifier of node reached using edge.

edge

BIGINT

Identifier of the edge used to arrive from pred to node.

  • \(-1\) when node = start_vid.

cost

FLOAT

Cost to traverse edge.

agg_cost

FLOAT

Aggregate cost from start_vid to node.

See Also

Indices and tables