Skip to content

raikuxq/apexds-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@apexds/graph

A comprehensive TypeScript library for graph data structures (directed, undirected) and advanced graph algorithms (BFS, DFS, Dijkstra, transpose, has path, shortest path.).

npm version minzip


Documentation

Detailed documentation is available at:
https://raikuxq-algorithms.netlify.app/guide/data-structures/graphs


Installing

Install by using any of these commands:

  • yarn add @apexds/graph
  • npm install @apexds/graph --save

Core lib

Core (implementation, tests, docs): @raikuxq/lab-ts-algorithms

Examples

import { 
  UndirectedGraph,
  shortestPath,
  EnumGraphTraversalType
} from '@apexds/graph';

const graph = new UndirectedGraph<string>();

graph
  .addVertex('London')
  .addVertex('Paris')
  .addVertex('Berlin')
  .addVertex('Tokyo');

graph
  .addEdge('London', 'Paris', 100)
  .addEdge('Paris', 'Berlin', 150)
  .addEdge('Berlin', 'Tokyo', 800)
  .addEdge('London', 'Berlin', 400);

const path = shortestPath({
  graph,
  from: 'London',
  to: 'Tokyo',
  traversalType: EnumGraphTraversalType.DIJKSTRA
});

About

A comprehensive TypeScript library for graph data structures (directed, undirected) and advanced graph algorithms (BFS, DFS, Dijkstra, transpose, etc.).

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors