lgraph_edge_index_iterator

namespace lgraph
namespace lgraph_api
class EdgeIndexIterator
#include <lgraph_edge_index_iterator.h>

EdgeIndexIterator can be used to access a set of edges that has the same indexed value. If the index is unique (that is, each Edge has a unique index value), then each EdgeIndexIterator will only have one edge unique id, and will become invalid after Next() is called.

An EdgeIndexIterator is valid iff it points to a valid (index_value, euid) pair, otherwise it is invalid. Calling member function on an invalid EdgeIndexIterator throws an exception, except for the IsValid() function.

Public Functions

EdgeIndexIterator(EdgeIndexIterator &&rhs)
EdgeIndexIterator &operator=(EdgeIndexIterator&&)
~EdgeIndexIterator()
void Close()

Closes this iterator.

bool IsValid() const

Query if this iterator is valid, i.e. the Key and Vid can be queried.

Returns

True if valid, false if not.

bool Next()

Move to the next edge unique id in the list, which consists of all the valid edge unique ids of the iterator and is sorted from small to large. If we hit the end of the list, iterator will become invalid and false is returned.

Returns

True if it succeeds, otherwise false.

FieldData GetIndexValue() const

Gets the current index value. The euids are sorted in ( EdgeIndexValue, euid) order. When Next() is called, the iterator moves from one euid to next, possibly moving from one EdgeIndexValue to another. This function tells the EdgeIndexValue currently pointed to.

Returns

The key.

EdgeUid GetUid() const

Gets the Edge Unique Id.

Returns

The UID.

int64_t GetSrc() const

Gets the source vertex id.

Returns

The source vertex id.

int64_t GetDst() const

Gets destination of the edge.

Returns

The destination vertex id.

size_t GetLabelId() const

Gets label id of this edge.

Returns

The label identifier.

int64_t GetEdgeId() const

Gets edge id.

Returns

The edge identifier.

Private Functions

EdgeIndexIterator(lgraph::EdgeIndexIterator &&it, const std::shared_ptr<lgraph::Transaction> &txn)
EdgeIndexIterator(const EdgeIndexIterator&) = delete
EdgeIndexIterator &operator=(const EdgeIndexIterator&) = delete

Private Members

std::unique_ptr<lgraph::EdgeIndexIterator> it_
std::shared_ptr<lgraph::Transaction> txn_

Friends

friend class Transaction