OVertex - getVertices()

This method retrieves all vertices connected by edges to this vertex.

Retrieving Vertices

In a Graph database, a vertex connects to other vertices through edges. Using this method you can follow the given edges to retrieve the connected OVertex instances.

Syntax

Edges in OrientDB have direction and all records are defined by a database class. In the case of direction, the edge is created pointing from one vertex to another. This direction is implemented as the ODirection class. Records have classes internal to the database, which are implemented as the OClass class. Vertices on the database belong either to the V class or as a class that extends the V class.

The first method uses the default V class. The other methods allow you to define what database class of vertices you want to retrieve.

// METHOD 1
Iterable<OVertex> OVertex().getVertices(ODirection dir)

// METHOD 2
Iterable<OVertex> OVertex().getVertices(ODirection dir, OClass... type)

// METHOD 3
Iterable<OVertex> OVertex().getVertices(ODirection dir, String... name)
ArgumentTypeDescription
dirODirectionDefines the direction to search
typeOClassDefines the database class
nameStringDefines the name of the database class

Return Value

This method returns an Iterable instance that contains a series of OVertex instances representing the connected vertices.