ARCcore.graph DirectedGraph Vertex Methods
Login
-Home
/
-Documentation
/
-ARCcore
/
-graph
/
-DirectedGraph
/
Vertex Methods
-DirectedGraph
+Algorithms
Examples
Vertex Methods
Edge Methods
Container Methods
API Objects
Serialization
DirectedGraph Vertex Methods Documentation
DirectedGraph container class vertex access methods.

See also: API Objects, Edge Methods, Container Methods, Serialization

Vertex methods allow you to add and remove vertices from a DirectedGraph container instance, attach, query, and remove application-specific properties from vertices, and determine which other vertices are adjacent to a specific vertex. Generally, vertex methods accept vertex read and vertex write objects as input parameters. These objects are explained in the API Objects section.

DirectedGraph.isVertex

digraph.isVertex(string);

Request

vertex read request

Response

Boolean true iff the vertex exists in the container. Otherwise false.

Notes

If you pass the ID of a non-existent vertex, or bad input the response will be false.

DirectedGraph.addVertex

var response = digraph.addVertex({ u: string, p: data});

Request

vertex write request

Response

JavaScript object with the following properties:

  • error: null or a string explaining what went wrong
  • result: the unique string identifier of the vertex added to the container or null if an error occurred

Notes

If specified, property data should be serializable to JSON. If you need to associate non-serializable data with a vertex, use an external dictionary indexed by vertex identifier.

If the vertex already exists in the container and property data was specified, then addVertex updates the vertex's property data in the container.

If the vertex already exists and no property data is specified, addVertex does nothing.

If your intention is to disassociate the vertex from property data, call clearVertexProperty method.

The setVertexProperty method is a convenience alias for the addVertex and their behavior is identical in all respects.

DirectedGraph.removeVertex

digraph.removeVertex(string);

Request

vertex read request

Response

Returns true if the vertex was removed. Otherwise, false.

Notes If the response is true, then all edges (both in and out-edges) directed towards and away from the removed vertex are automatically removed as well.

If you pass bad input, or the vertex doesn't exist in the container the call returns false.

DirectedGraph.getVertexProperty

var response = digraph.getVertexProperty(string);

Request

vertex read request

Response

Returns a reference to data associated with the vertex in the container. If the vertex has no associated property data, the call returns undefined.

Notes

getVertexProperty will return undefined if passed bad input.

DirectedGraph.setVertexProperty

setVertexProperty is an alias for method addVertex.

DirectedGraph.hasVertexProperty

var response = digraph.hasVertexProperty(string);

Request

vertex read request

Response

Returns true if the vertex has associated property data. Otherwise, false.

Notes:

hasVertexProperty will return false if the request is invalid, or the vertex does not exist in the graph, or the vertex exists and does not have associated property data.

DirectedGraph.clearVertexProperty

var response = digraph.clearVertexProperty(string);

Request vertex read request

Return

Returns true to indicate that the vertex property data has been cleared. Otherwise, false.

Notes

clearVertexProperty will return false if the request is invalid, or if the vertex does not exist in the graph.

DirectedGraph.inDegree

var response = digraph.inDegree(string);

Request

vertex read request

Response

Integer indicating the in-degree of the specific vertex.

Notes inDegree will return minus one (-1) if the request is invalid.

DirectedGraph.inEdges

var response = digraph.inEdges(string);

Request

vertex read request

Response

Array of edge descriptor objects specifying the source and sink vertex ID's of each of the specified vertex's in-edges.

response = [
    { u: string, v: string },
    //...
];

Notes

inEdges will return an empty array if the request is invalid, or if the vertex has no in-edges.

DirectedGraph.outDegree

var response = digraph.outDegree(string);

Request

vertex read request

Response

Integer indicating the out-degree of the specific vertex.

Notes

outDegree will return minus one (-1) if the request is invalid.

DirectedGraph.outEdges

var response = digraph.outEdges(string);

Request

vertex read request

Response

Array of edge descriptor objects specifying the source and sink vertex ID's of each of the specified vertex's out-edges.

response = [
    { u: string, v: string },
    // ...
]

Notes

outEdges will return an empty array if the request is invalid, or if the vertex has no in-edges.

Encapsule Project, Seattle WA
Copyright © 2018 Chris Russell
Sat Dec 15 2018 03:32:30 GMT-0500 (EST)

Encapsule/holism v0.0.26
Documents Under Contruction