ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::EliasFanoGraph Class Reference

a static directed graph with its adjacency lists in Elias-Fano More...

#include <ADS/succinct/EliasFanoGraph.h>

Public member functions

 EliasFanoGraph (void)=default
 the graph with no node
 EliasFanoGraph (const std::vector< std::vector< std::size_t > > &a)
 the graph of the adjacency lists \( a \), the node \( u \) having the successors \( a[ u ] \)
std::size_t order (void) const
 the number of nodes, \( n \)
std::size_t edges (void) const
 the number of edges, \( m \)
std::size_t outdegree (std::size_t u) const
 the number of successors of \( u \), \( \mathit{start}[ u + 1 ] - \mathit{start}[ u ] \)
std::size_t successor (std::size_t u, std::size_t i) const
 the \( i \)-th successor of \( u \), from 0, i.e., \( E[ \mathit{start}[ u ] + i ] - u n \)
std::vector< std::size_t > successors (std::size_t u) const
 the successors of \( u \), in increasing order, by successor()
bool hasEdge (std::size_t u, std::size_t v) const
 whether \( ( u , v ) \) is an edge, i.e., whether \( u n + v \) is in the sequence of the edges
std::size_t sizeInBits (void) const
 the bits of the two sequences, with their directories
template<class A>
void persist (A &a)
 the members written to, or read from, the archive \( a \) [see Persistence.h]

Static public attributes

static constexpr std::string_view persistName = "EliasFanoGraph"
 the name of the structure in a file [see Persistence.h]

Detailed description

a static directed graph with its adjacency lists in Elias-Fano

Constructor and destructor documentation

◆ EliasFanoGraph() [1/2]

ADS::EliasFanoGraph::EliasFanoGraph ( void )
default

the graph with no node

◆ EliasFanoGraph() [2/2]

ADS::EliasFanoGraph::EliasFanoGraph ( const std::vector< std::vector< std::size_t > > & a)
explicit

the graph of the adjacency lists \( a \), the node \( u \) having the successors \( a[ u ] \)

In pseudocode (the lists of Elias-Fano of Vigna, beyond the book), as one sequence of edges and one of starts:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{build}( a ) \cr 2 & \quad E \gets ();\ S \gets () \cr 3 & \quad \textbf{for}\ u \gets 0\ \textbf{to}\ n - 1\ \textbf{do} \cr 4 & \qquad \text{append } |E| \text{ to } S \cr 5 & \qquad \textbf{foreach}\ v \in a[ u ]\ \textbf{do}\ \text{append } u n + v \text{ to } E \cr 6 & \quad \text{append } |E| \text{ to } S \cr 7 & \quad \textbf{return}\ ( \text{Elias-Fano of } E \text{ in } [ 0 , n^2 ) , \text{Elias-Fano of } S \text{ in } [ 0 , |E| ] ) \end{array}} \]

Precondition
each \( a[ u ] \) is strictly increasing in \( [ 0 , n ) \), \( n^2 < 2^{64} \)

Member function documentation

◆ edges()

std::size_t ADS::EliasFanoGraph::edges ( void ) const
nodiscard

the number of edges, \( m \)

◆ hasEdge()

bool ADS::EliasFanoGraph::hasEdge ( std::size_t u,
std::size_t v ) const
nodiscard

whether \( ( u , v ) \) is an edge, i.e., whether \( u n + v \) is in the sequence of the edges

Precondition
\( u , v < \mathrm{order}() \)

◆ order()

std::size_t ADS::EliasFanoGraph::order ( void ) const
nodiscard

the number of nodes, \( n \)

◆ outdegree()

std::size_t ADS::EliasFanoGraph::outdegree ( std::size_t u) const
nodiscard

the number of successors of \( u \), \( \mathit{start}[ u + 1 ] - \mathit{start}[ u ] \)

Precondition
\( u < \mathrm{order}() \)

◆ persist()

template<class A>
void ADS::EliasFanoGraph::persist ( A & a)

the members written to, or read from, the archive \( a \) [see Persistence.h]

◆ sizeInBits()

std::size_t ADS::EliasFanoGraph::sizeInBits ( void ) const
nodiscard

the bits of the two sequences, with their directories

◆ successor()

std::size_t ADS::EliasFanoGraph::successor ( std::size_t u,
std::size_t i ) const
nodiscard

the \( i \)-th successor of \( u \), from 0, i.e., \( E[ \mathit{start}[ u ] + i ] - u n \)

Precondition
\( u < \mathrm{order}() \) and \( i < \mathrm{outdegree}( u ) \)

◆ successors()

std::vector< std::size_t > ADS::EliasFanoGraph::successors ( std::size_t u) const
nodiscard

the successors of \( u \), in increasing order, by successor()

Precondition
\( u < \mathrm{order}() \)

Member data documentation

◆ persistName

std::string_view ADS::EliasFanoGraph::persistName = "EliasFanoGraph"
staticconstexpr

the name of the structure in a file [see Persistence.h]


The documentation for this class was generated from the following file: