ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
EliasFanoGraph.h File Reference

A static directed graph whose adjacency lists are coded by Elias-Fano [see EliasFano.h] (chapter 15, Compressed Data Structures, of Ferragina's book), the representation of the adjacency lists of large graphs in Facebook's Unicorn and in the quasi-succinct indices of Vigna. More...

#include "ADS/Contract.h"
#include "ADS/succinct/EliasFano.h"
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <string_view>
#include <vector>
#include "ADS/succinct/impl/EliasFanoGraph.tpp"

Go to the source code of this file.

Classes

class  ADS::EliasFanoGraph
 a static directed graph with its adjacency lists in Elias-Fano More...

Namespaces

namespace  ADS

Detailed description

A static directed graph whose adjacency lists are coded by Elias-Fano [see EliasFano.h] (chapter 15, Compressed Data Structures, of Ferragina's book), the representation of the adjacency lists of large graphs in Facebook's Unicorn and in the quasi-succinct indices of Vigna.

The edge \( ( u , v ) \) of a graph of \( n \) nodes is the integer \( u n + v \), so that the lists, each one sorted, are one increasing sequence in \( [ 0 , n^2 ) \), and the prefix sums of the outdegrees are a second sequence that tells where the list of \( u \) starts; with \( m \) edges the graph takes about \( m ( 2 + \lceil \log_2 ( n^2 / m ) \rceil ) + n ( 2 + \lceil \log_2 ( m / n ) \rceil ) \) bits, plus the directories, and answers in \( O( 1 ) \) time the outdegree and the \( i \)-th successor of a node, and the existence of an edge by nextGEQ() in \( O( 1 ) \) expected time.

The same chapter codes each list on its own, with its own universe: since \( \sum_u d_u \log ( n / d_u ) \le m \log ( n^2 / m ) \) by the concavity of the logarithm, the lists alone can take fewer bits when the degrees are skewed, at the price of a directory and an offset per list; the single sequence here keeps one directory and the same \( O( 1 ) \) access. Neither exploits the locality and the similarity of the lists of the Web, which the codes of Boldi and Vigna do [see BVGraph.h], nor the clustering of the adjacency matrix, which the \( k^2 \)-tree does [see K2Tree.h].

The contracts [see Contract.h]: each list is strictly increasing (an audit) with its nodes in \( [ 0 , n ) \), \( n^2 \) fits in 64 bits, and the nodes and the places asked for exist. The functions are defined in EliasFanoGraph.tpp.

See also
P. Ferragina, Pearls of Algorithm Engineering, Cambridge University Press, 2023, chapter 15, Compressed Data Structures, doi:10.1017/9781009128933
S. Vigna, Quasi-succinct indices, Proc. 6th WSDM, 83-92, 2013, doi:10.1145/2433396.2433409
M. Curtiss et al., Unicorn: a system for searching the social graph, Proc. VLDB Endowment 6(11), 1150-1161, 2013, doi:10.14778/2536222.2536239
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa