Namespace: Graph

Graph

A Graph object with the basic properties
Properties:
Name Type Description
vertices object The vertices of the graph
edges array The edges of the graph
length number Length of the graph
Source:

Classes

Edge
Vertex

Methods

addEdge() → {Graph.Edge}

Method for adding new Graph.Edge
Source:
Returns:
An instance of a Graph.Edge
Type
Graph.Edge

addVertex(name, value) → {Graph.Vertex}

Add a new Graph.Vertex or updates the value of an existing one
Parameters:
Name Type Description
name string Name of the new vertex
value number Value of the new vertex
Source:
Returns:
New or updated Graph.Vertex
Type
Graph.Vertex
Example
var newVertex = Graph.addVertex("vertex1", 20);