From 5be1835344f37535559382acc953ec5901db0f48 Mon Sep 17 00:00:00 2001 From: Maksymilian Jopek Date: Thu, 13 Apr 2023 20:08:01 +0200 Subject: Add License and Readme Add pathfinder files Change start to be simpler --- src/pathfinder/Graph.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/pathfinder/Graph.ts (limited to 'src/pathfinder/Graph.ts') diff --git a/src/pathfinder/Graph.ts b/src/pathfinder/Graph.ts new file mode 100644 index 0000000..2a62f9a --- /dev/null +++ b/src/pathfinder/Graph.ts @@ -0,0 +1,25 @@ +/** + @module Graph +*/ +/** Types for directed graph */ +/** Shortuct */ +export type Graph = Array; + +/** Type for vertex of graph */ +export interface Vertex { + edges: Array; // Graph is directed so all edges will have from set to `this` + start: boolean; + goal: boolean; + walkable: boolean; + uuid: string; + graph: Graph; + x?: number; + y?: number; +} +/** Type for edge of graph */ +export interface Edge { + from: Vertex; + to: Vertex; + weight: number; +} + -- cgit v1.3.1