Template Class Edges

Class Documentation

template<EdgeOrientation Orientation>
class Edges

Forward declarations.

Manipulate the edges of a graph

Public Functions

Edges(GraphImpl<Orientation> &pimpl)

Construct a Edges.

Parameters
  • pimpl: Pointer to implementation

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

Iterator over the edges of the graph.

Return

edge iterator

Parameters
  • position: starting position, default at the beginning

EdgeIterator end() const

Return

an iterator referring to the past-the-end

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

Create an edge between 2 vertices. Both vertices must already be in the graph.

Return

information whether operation succeeded or not

Parameters
  • vertex1: one end of the edge

  • vertex2: second end of the edge

  • commit: whether uncommitted operations should be flushed or not

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

Create an edge between 2 vertices. Both vertices must already be in the graph.

Return

information whether operation succeeded or not

Parameters
  • vertex1: one end of the edge

  • vertex2: second end of the edge

  • data: payload of the edge

  • size: payload length

  • commit: whether uncommitted operations should be flushed or not

Status insert(const vertex_uid_t &vertex, const vertex_uids_t &vertices, const std::vector<const char *> &data = {}, const std::vector<std::size_t> &sizes = {}, bool commit = false)

Create edges between a vertex and several vertices.

Return

information whether operation succeeded or not

Parameters
  • vertex: the vertex to connect to others

  • vertices: the vertices to connect to vertex

  • data: payloads of every edges to create

  • sizes: the sizes of the payloads

  • commit: whether uncommitted operations should be flushed or not

Status insert(const vertex_uid_t &vertex, vertex_t type, const vertex_id_t *vertices, size_t num_vertices, bool create_vertices = false, bool commit = false)

Create edges between a vertex and several vertices of the same type.

Return

information whether operation succeeded or not

Parameters
  • vertex: the vertex to connect to others

  • type: target vertices type

  • vertices: the vertices to connect to vertex

  • num_vertices: number of target vertices

  • create_vertices: whether vertices should be created as well

  • commit: whether uncommitted operations should be flushed or not

Status insert(const vertex_uid_t &vertex, vertex_t type, const std::size_t *vertices, const char *const *vertex_payloads, const std::size_t *vertex_payloads_sizes, size_t num_vertices, bool create_vertices = false, bool commit = false)

Creates edges between a vertex and several vertices of the same type.

Return

information whether operation succeeded or not

Parameters
  • vertex: the vertex to connect to others

  • type: target vertices type

  • vertices: the vertices to connect to vertex

  • vertex_payloads: payload of every target vertex Use nullptr is there is no payload.

  • vertex_payloads_sizes: payload size of every target vertex

  • num_vertices: number of target vertices

  • create_vertices: whether vertices should be created as well

  • commit: whether uncommitted operations should be flushed or not

Status get(const edge_uid_t &edge, std::string *value) const

Retrieve an edge payload.

Return

information whether operation succeeded or not

Parameters
  • edge: unique identifier to retrieve

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

Status has(const vertex_uid_t &vertex1, const vertex_uid_t &vertex2, bool &result) const

check connectivity between 2 vertices

Return

provides information whether operation succeeded or not

Parameters
  • vertex1: first end of the edge to look for

  • vertex2: second end of the edge to look for

  • result: a boolean indicating whether vertex1 and vertex2 are connected

Status get(const vertex_uid_t &vertex, vertex_uids_t &edges) const

get vertices connected to a vertex

Return

information whether operation succeeded or not

Parameters
  • vertex: for directed graph, the head of the edges to look for, any end of the edges otherwise

  • edges: accumulator where connected vertices are added.

Status get(const vertex_uid_t &vertex, vertex_t filter, vertex_uids_t &edges) const

get vertices of a specific type connected to one vertex

Return

information whether operation succeeded or not

Parameters
  • vertex: one end of the edges to look

  • filter: type of target vertices

  • edges: accumulator where connected vertices are added

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

remove edge between 2 vertices

Return

information whether operation succeeded or not

Parameters
  • vertex1: one end of the edge to remove

  • vertex2: other end of the edge to remove

  • commit: whether uncommitted operations should be flushed or not

Status erase(const vertex_uid_t &vertex, vertex_t filter, size_t &removed, bool commit = false)

remove edges of a given type

Return

information whether operation succeeded or not

Parameters
  • vertex: vertex from which to remove edges

  • filter: type of target vertices

  • removed: number of vertices removed during the operation

  • commit: whether uncommitted operations should be flushed or not

Status erase(const vertex_uid_t &vertex, std::size_t &removed, bool commit = false)

remove all edges of a vertex

Return

information whether operation succeeded or not

Parameters
  • vertex: one end of the edges to remove

  • commit: whether uncommitted operations should be flushed or not

  • removed: number of vertices removed during the operation

Status count(std::size_t &count) const

Return

information whether operation succeeded or not

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

Status clear(bool commit)

Remove all edges of the graph along. Vertices are kept intact.

Return

information whether operation succeeded or not

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