open-index/open-npm huggingface dataset:
npm package: @gsvlabs/graph-search
Description: Simple library to search and traverse graphs using DFS, BFS algorithms, and also detect cycles in directed graph input
Author: Sai Vinay G
Latest version: 1.0.1

# Graph Seach Alogorithms Implementation in Javascript

Simple and fast library containing collection of algorithms to search and traverse graphs using DFS or BFS, check if a path exists between two nodes and also detect cycles in directed graph input.

[![workflow](https://github.com/gsaivinay/graph-search/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/gsaivinay/graph-search/actions/workflows/npm-publish.yml) [![npm version](https://img.shields.io/npm/v/@gsvlabs/graph-search)](https://www.npmjs.com/package/@gsvlabs/graph-search) [![NPM Downloads](https://img.shields.io/npm/dt/@gsvlabs/graph-search)](https://www.npmjs.com/package/@gsvlabs/graph-search) ![NPM License](https://img.shields.io/npm/l/@gsvlabs/graph-search)

## Installation

```bash
npm i @gsvlabs/graph-search
```

## Usage

### Example 1

```javascript
import Graph from '@gsvlabs/graph-search';

//For old fashioned CommonJS
const Graph = require('@gsvlabs/graph-search').default;

// Sample graph input object
let edges = [
    { source: '0', target: '9' },
    { source: '9', target: '2' },
    { source: '2', target: '3' },
    { source: '2', target: '4' },
    { source: '3', target: '8' },
    { source: '8', target: '13' },
    { source: '8', target: '10' },
    { source: '10', target: '11' },
    { source: '10', target: '14' },
    { source: '14', target: '13' },
    { source: '11', target: '12' },
    { source: '4', target: '5' },
    { source: '5', target: '6' },
    { source: '5', target: '7' },
    { source: '13', target: '1' },
    { source: '6', target: '13' },
    { source: '12', target: '13' },
    { source: '7', target: '13' }
];

// Create object from Graph class with parameter as true indicating that input graph is directed
// false for undirected graphs
let g = new Graph(true);

// Add edges to graph using edges object
g.addFromObject(edges, 'source', 'target');

// Manually add edge from source to target
// g.addEdge('13', '8');

// Print graph with paths
console.log(g.getGraph());

// Print if input directed graph is cyclic
// Works only if input graph is set as directed in constructor `new Graph(true)`
console.log(`Is cyclic: ${g.isCyclic()}`);

// Check if path exists between two nodes
// returns array[boolean, array[nodes]]
console.log(g.isPathExists('9', '4'));

// Print path from a source vertex with depth first search algorithm 
console.log(g.dfs('0'));

// Print path from a source vertex with breadth first search algorithm
console.log(g.bfs('0'));

```
npm package: @gswag/js-utils
Description: Some utility functions for JS/TS
Author: Asif Mahmud Shimon
Latest version: 0.0.4


# Table of Contents

1.  [JS Utils](#orgb497a09)
2.  [Installation](#orga7e3739)
3.  [Documentation](#org7bad65a)
4.  [Issues](#orge66103a)



<a id="orgb497a09"></a>

# JS Utils

Collection of some utility functions for javascript/typescript.


<a id="orga7e3739"></a>

# Installation

If you are using `npm` - 

    npm i -S @gswag/js-utils

If you are using `yarn` -

    yarn add @gswag/js-utils


<a id="org7bad65a"></a>

# Documentation

Link - [https://asif-mahmud.github.io/js-utils](https://asif-mahmud.github.io/js-utils)


<a id="orge66103a"></a>

# Issues

Link - [https://github.com/asif-mahmud/js-utils/issues](https://github.com/asif-mahmud/js-utils/issues)