Holds all the vertices in the graph indexed by a json string of the form:
{id: 123, type: "MyVertexType"}
Returns a flat Array of vertices in this graph.
Adds the given verted to the graph. If a vertex with this combination of id and type already exists then it throws an error instead.
A helper function for argument sanitisation. This funciton makes sure that none of its arguments have the same id and type. If one is found it will throw an error.
A helper function for argument sanitisation. This funciton makes sure that all of its arguments exist in the graph. If not then it will throw an error
A helper function for argument sanitisation. This funciton makes sure that none of its arguments have the same id and type as a vertex in the graph. If one is found it will throw an error.
Removes the given vertices from the graph
Returns the vertex with the given id and type. If no type is given then null is assumed.
Returns an object with a getter funciton for returning all the vertices that the given vertex is connected to by the given Edge rule. If no matches are found and multiple is flase then null is returned else an empty array and returned
Helper function for [[addVerted]] used to add the edges on a vertex when it is inserted into the graph.
Generated using TypeDoc
A graph is a collection of vertices and edges (maps to other vertices). It exposes 2 functions: add_vertex and get_vertex that do as their names suggest, add and retrieve vertices to and from the graph respectively.
graph = new Graph(); graph.add_vertex(myvertex1, myvertex2, myvertex3); // Adds the 3 vertices to the graph console.log(graph.get_vertex({id: 1, type: "testvertex"});) // Vertex with id 1 and type "testvertex"