Home Reference Source
import Graph from 'algorithmsjs/src/Graph.js'
public class | source

Graph

Graph: represents a graph data structure.

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public

addVertex(value: value): Graph

public

addVerticies(array: values): Graph

public
public
public

Public Constructors

public constructor source

Public Methods

public addVertex(value: value): Graph source

Params:

NameTypeAttributeDescription
value value

to set on the vertex

Return:

Graph

current instance of graph.

public addVerticies(array: values): Graph source

Params:

NameTypeAttributeDescription
array values

of values to add to the graph

Return:

Graph

current instance of graph.

public getVertexValues(): Array source

Return:

Array

array of values in all graph vertices.

public getVertices(): Array source

Return:

Array

array of all Vertex instances in this graph.

public hasVertexWithValue(value: value): Boolean source

Params:

NameTypeAttributeDescription
value value

to find in the graph.

Return:

Boolean

true if any vertex has this value else false