Interface: WeightedGraph<Location>

graphs.WeightedGraph

Type parameters

Name
Location

Hierarchy

  • Graph<Location>

    WeightedGraph

Implemented by

Methods

getCost

getCost(fromId, toId): number

Provides the cost to move directly from location A to location B, assuming there is a direct connection For some graphs, this may just be the cost to enter location B, but it is technically the cost of traversing the connection.

Ensure a direct connection exists before using! Allowed to throw, but may also return a weight for a non-existant connection.

Parameters

Name Type Description
fromId Location Location A
toId Location Location B

Returns

number


neighbors

neighbors(id): undefined | Location[]

Returns the set of direct connections reachable from a location.

Parameters

Name Type Description
id Location The location to check for connections from

Returns

undefined | Location[]

Inherited from

Graph.neighbors