Giter Club home page Giter Club logo

pbgraphs.js's Introduction

pbGraphs.js

pbGraphs.js is a graph library for JavaScript.

Requirements

JavaScript 5+. Works in browsers, NodeJS and Java's script engine.

Dependencies

There are no dependencies.

Getting Started

It is easy to get started. Simply include the sources in your project. Check out test.js in the source directory for an example.

Avaialble in 12 different programming languages

pbGraphs-java has been implemented with progsbase, so the library is available for 12 different programming languages.

Try all functions online and see the implementations in different languages.

Functions

Graph Equality

function DirectedGraphsEqual(a, b)

Returns true of the two directed graphs are equal.

Graph Components

function GetGraphComponents(g, componentMembership)

Places the list of strongly connected components in componentMembership. Returns false if graphs does not quality as undirected.

Topological Sort

function TopologicalSort(g, list)

Places the topological sort of the graph in list.

Searches

  • Depth-first Search
function DepthFirstSearch(g, start, list)

Places the depth-first sort ordering of the graph in list.

  • Breadth-first Search
function BreadthFirstSearch(g, start, list)

Places the breadth-first sort ordering of the graph in list.

Shortest Paths

  • Dijkstra's Algorithm
function DijkstrasAlgorithm(g, src, dist, distSet, prev)

Performs Dijkstra's algorithm on the graph g from src. Whether nodes are reachable is placed in distSet, the shortest distances in dist, and the previous node in the shortest paths in prev.

  • Bellman-Ford Algorithm
function BellmanFordAlgorithm(g, src, dist, distSet, prev)

Performs the Bellman-Ford algorithm on the graph g from src. Whether nodes are reachable is placed in distSet, the shortest distances in dist, and the previous node in the shortest paths in prev.

  • Floyd-Warshall Algorithm
function FloydWarshallAlgorithm(g, distances)

Performs the Floyd-Warshall algorithm on the graph g. The shortest distances between each pair of nodes are placed in distances.

Minimum Spanning Trees

  • Prim's Algorithm
function PrimsAlgorithm(g, forest)

Performs the Prim's algorithm on the graph g. All minimum spanning trees of the graph are placed in forest. Returns false if graphs does not quality as undirected.

  • Kruskal's Algorithm
function KruskalsAlgorithm(g, forest)

Performs the Kruskal's algorithm on the graph g. All minimum spanning trees of the graph are placed in forest. Returns false if graphs does not quality as undirected.

Cycles

  • Cycle Detection
function DirectedGraphContainsCycleDFS(g)

Return true if there are cycles in the graph g.

  • Cycle Counting
function DirectedGraphCountCyclesDFS(g)

Return the number of cycles in the graph g.

  • Get All Cyles
function DirectedGraphGetCyclesDFS(g)

Returns the list of cycles in the graph g.

pbgraphs.js's People

Contributors

martinfjohansen avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.