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

The compression of the adjacency lists of Boldi and Vigna (chapter 15, Compressed Data Structures, of Ferragina's book), designed for the Web graphs, whose nodes are the pages sorted by URL: locality (most links stay in the host, so that the successors of \( x \) are close to \( x \) and to each other) and similarity (the pages of a host link to the same pages). More...

#include "ADS/Contract.h"
#include "ADS/compression/IntegerCodes.h"
#include "ADS/succinct/BitStream.h"
#include "ADS/succinct/BitVector.h"
#include "ADS/succinct/EliasFano.h"
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <string_view>
#include <utility>
#include <vector>
#include "ADS/succinct/impl/BVGraph.tpp"

Go to the source code of this file.

Classes

class  ADS::BVGraph
 a static directed graph with the lists compressed by reference, copy blocks, intervals and gaps More...

Namespaces

namespace  ADS

Detailed description

The compression of the adjacency lists of Boldi and Vigna (chapter 15, Compressed Data Structures, of Ferragina's book), designed for the Web graphs, whose nodes are the pages sorted by URL: locality (most links stay in the host, so that the successors of \( x \) are close to \( x \) and to each other) and similarity (the pages of a host link to the same pages).

The list of \( x \) is written as:

  • its outdegree, in \( \gamma \) [see IntegerCodes.h];
  • the reference \( r \): the list of \( x - r \), among the previous \( W \) lists (the window), that shares the most successors with that of \( x \), 0 for none;
  • the copy list of the reference, a bit per successor of \( x - r \) telling whether it is a successor of \( x \) too, written as copy blocks: its first bit, then the lengths less 1 of its runs, the last one omitted since the outdegree of the reference tells it;
  • the extra nodes, the successors not copied: the runs of at least \( L_{\min} \) consecutive integers as intervals, the left extreme as a gap from the previous right extreme less 2 (the first one from \( x \), by signedToNatural()) and the length less \( L_{\min} \), then the residuals as gaps less 1 (the first one from \( x \), by signedToNatural()), in \( \delta \).

A list is decoded from its place in the stream, kept for every node in an Elias-Fano sequence [see EliasFano.h], after the list of its reference; the chains of references are at most \( R \) long, so that a list is decoded in \( O( R d ) \) time for outdegrees up to \( d \). With the window \( W = 7 \), the chains \( R = 3 \) and \( L_{\min} = 4 \) (the defaults of the WebGraph framework) the Web graphs take about 3 bits per edge, against the \( \log_2 n \) bits of a plain list and the \( 2 + \log ( n^2 / m ) \) of Elias-Fano [see EliasFanoGraph.h]; the \( k^2 \)-tree [see K2Tree.h] is comparable in space and also gives the predecessors. The WebGraph framework codes the gaps by the \( \zeta \) codes, tuned to their power-law distribution, and reorders the nodes (e.g., by layered label propagation) to make locality stronger; neither is in the same chapter.

copyList(), copyBlocks(), intervals() and residualGaps() are the steps of the coding, given for the examples of the same chapter.

The contracts [see Contract.h]: each list is strictly increasing (an audit) with its nodes in \( [ 0 , n ) \), the window and the chains are at least 1 and \( L_{\min} \ge 2 \); the audit of the construction is that each list is decoded back. The functions are defined in BVGraph.tpp.

See also
P. Ferragina, Pearls of Algorithm Engineering, Cambridge University Press, 2023, chapter 15, Compressed Data Structures, doi:10.1017/9781009128933
P. Boldi, S. Vigna, The WebGraph framework I: compression techniques, Proc. 13th WWW, 595-602, 2004, doi:10.1145/988672.988752
P. Boldi, M. Rosa, M. Santini, S. Vigna, Layered label propagation: a multiresolution coordinate-free ordering for compressing social networks, Proc. 20th WWW, 587-596, 2011, doi:10.1145/1963405.1963488
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa