Skip to content
D4L edited this page Feb 10, 2013 · 1 revision

Vertices

Description

A vertex is a discrete point in a graph. It is, in essence, the data we are trying to manipulate and conceive.

Properties

A vertex can be analysed and manipulated through it's name, which is a string passed when adding the vertex.
Note that this name must be unique to the vertex, so the number of distinct names of vertices in a given graph must be equal to the number of vertices.

Operations

Add vertex

adds a vertex to the graph with the specified name

@graph.add_vertex "MyVertex"

Has vertex

will check if the graph has a certain vertex

@graph.has_vertex? "MyVertex"

Delete vertex

will delete a vertex from the graph

@graph.delete_vertex "MyVertex"