forked from anvaka/ngraph.path
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
31 lines (22 loc) · 1.22 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Type definitions for ngraph.path v1.0.2
// Project: https://github.com/anvaka/ngraph.path
// Definitions by: Nathan Westlake <https://github.com/CorayThan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Graph, Link, Node, NodeId } from "ngraph.graph"
declare module "ngraph.path" {
interface PathFinderOptions<NodeData, LinkData> {
oriented?: boolean
quitFast?: boolean
heuristic?: (from: Node<NodeData>, to: Node<NodeData>) => number
distance?: (from: Node<NodeData>, to: Node<NodeData>, link: Link<LinkData>) => number
}
/**
* inlcudeLinks only works for a-star.js
*/
interface PathFinder<NodeData> {
find: (from: NodeId, to: NodeId, includeLinks?:boolean) => Node<NodeData>[]
}
export function aStar<NodeData, LinkData>(graph: Graph<NodeData, LinkData>, options?: PathFinderOptions<NodeData, LinkData>): PathFinder<NodeData>
export function aGreedy<NodeData, LinkData>(graph: Graph<NodeData, LinkData>, options?: PathFinderOptions<NodeData, LinkData>): PathFinder<NodeData>
export function nba<NodeData, LinkData>(graph: Graph<NodeData, LinkData>, options?: PathFinderOptions<NodeData, LinkData>): PathFinder<NodeData>
}