🗺️ New Graph module to do graph data structures and algorithms with built in path finding! Thanks Justin Young!
Features:
- Nodes with custom data
- Weighted, directed or undirected edges
- Position nodes in 2D space for spatial algorithms
- Built in BFS and DFS
- Path finding!
ALT Code Snippet
```typescript
import { Graph } from 'excalibur';
// Create an empty graph of strings
const graph = new Graph<string>();
// Add a few nodes with string data
const nodeA = graph.addNode("A");
const nodeB = graph.addNode("B");
const nodeC = graph.addNode("C");
// Connect nodes with bidirectional edges (default)
graph.addEdge(nodeA, nodeB);
graph.addEdge(nodeB, nodeC);
graph.addEdge(nodeC, nodeD);
graph.addEdge(nodeD, nodeE);
// Check if nodes are connected
const connected = graph.areNodesConnected(nodeA, nodeB); // true
// Get neighbors of a node
const neighbors = graph.getNeighbors(nodeA); // [nodeB]
// Find shortest path from A to C
const { path, distance } = graph.shortestPathDijkstra(nodeA, nodeC);
const aStarResults = graph.astar(nodeA, nodeB);
```