Skip to content

AlexandreLeonetti/graph-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graph Search implemented on 2D matrix using TypeScript.

graph search implemented on 2D matrix using TypeScript.

Install

npm install @leonetti/graph-search

Usage

import {mazeSearch} from '@leonetti/graph-search';


/* define the maze */

const maze = [
        [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 1, 1, 0, 1, 1, 1, 1, 1, 0],
        [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
        [0, 1, 1, 1, 1, 0, 1, 1, 1, 1],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 1, 1, 0, 1, 1, 1, 1, 1, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
];

/* define start and end points row column */
const start = { x: 0, y: 0 };
const end = { x: 9, y: 9 };

mazeSearch(maze, start, end);

About

graph search

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published