Template Class Vertices

Class Documentation

template<EdgeOrientation Orientation>
class Vertices

Manipulate graph vertices.

Public Functions

Vertices(GraphImpl<Orientation> &pimpl)

Build a Vertices

Parameters
  • pimpl: Pointer to implementation

VertexIterator begin(std::size_t position = 0) const

Iterate over vertices.

Return

vertex iterator

Parameters
  • position: starting position, default at the beginning

VertexIterator end() const

Return

an iterator referring to the past-the-end

Status count(std::size_t &count) const

get number of vertices in the graph

Return

information whether operation succeeded or not

Parameters
  • count: non-const reference updated by this member function with the number of vertices in the graph

Status count(vertex_t type, std::size_t &count) const

get number of vertices of a certain type in the graph

Return

information whether operation succeeded or not

Parameters
  • type: type of vertex

  • count: non-const reference updated by this member function

Status clear(bool commit)

Remove all vertices of the graph along with their edges.

Return

information whether operation succeeded or not

Parameters
  • commit: whether uncommitted operations should be flushed or not

Status insert(const vertex_uid_t &vertex, bool commit = false)

Insert a vertex in the graph.

Return

information whether operation succeeded or not

Parameters
  • vertex: the vertex unique identifier to insert

  • commit: whether uncommitted operations should be flushed or not

template<typename Payload>
Status insert(const vertex_uid_t &vertex, const Payload &data, bool commit = false)

Insert a vertex in the graph.

Return

information whether operation succeeded or not

Template Parameters
  • Payload: vertex payload type

Parameters
  • vertex: the vertex unique identifier to insert

  • data: vertex payload

  • commit: whether uncommitted operations should be flushed or not

Status insert(const vertex_uid_t &vertex, const char *data, std::size_t size, bool commit = false)

Insert a vertex in the graph.

Return

information whether operation succeeded or not

Parameters
  • vertex: vertex unique identifier to insert

  • data: vertex payload

  • size: payload length

  • commit: whether uncommitted operations should be flushed or not

Status insert(const vertex_t *types, const vertex_id_t *ids, const char *const *payloads, const std::size_t *payloads_sizes, size_t num_vertices, bool commit = false)

Insert a list of vertices all at once.

Return

information whether operation succeeded or not

Parameters
  • types: array of vertex types

  • ids: array of vertex identifiers

  • payloads: array of serialized data, nullptr if none of the vertices have a payload

  • payloads_sizes: size of every payloads, nullptr if none of the vertex have a payload

  • num_vertices: number of vertexs to insert

  • commit: whether uncommitted operations should be flushed or not

template<typename T>
Status get(const vertex_uid_t &vertex, T &payload) const

Retrieve a vertex from the graph.

Return

information whether operation succeeded or not

Template Parameters
  • T: vertex payload type

Parameters
  • vertex: the vertex to retrieve

  • payload: object updated if vertex is present

Status get(const vertex_uid_t &vertex, std::string *value) const

Retrieve a vertex payload.

Return

information whether operation succeeded or not

Parameters
  • vertex: the vertex to retrieve

  • value: payload object updated if vertex exists and has an associated payload

Status has(const vertex_uid_t &vertex, bool &result) const

Check presence of a vertex in the graph.

Return

information whether operation managed to update result

Parameters
  • vertex: the vertex to look for

  • result: reference set to true if vertex exists, false otherwise

Status erase(const vertex_uid_t &vertex, bool commit = false)

Remove a vertex from the graph.

Return

information whether operation succeeded or not

Parameters
  • vertex: the vertex to remove

  • commit: whether uncommitted operations should be flushed or not