ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
EliasFanoGraph.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*-------------------------- File EliasFanoGraph.h -------------------------*/
3/*--------------------------------------------------------------------------*/
50/*--------------------------------------------------------------------------*/
51/*----------------------------- DEFINITIONS --------------------------------*/
52/*--------------------------------------------------------------------------*/
53
54#ifndef __ADS_EliasFanoGraph
55 #define __ADS_EliasFanoGraph
56/* self-identification: #endif constant */
57
58/*--------------------------------------------------------------------------*/
59/*------------------------------ INCLUDES ----------------------------------*/
60/*--------------------------------------------------------------------------*/
61
62#include "ADS/Contract.h"
64
65#include <algorithm>
66#include <cstddef>
67#include <cstdint>
68#include <string_view>
69#include <vector>
70
71/*--------------------------------------------------------------------------*/
72/*--------------------------- NAMESPACE ------------------------------------*/
73/*--------------------------------------------------------------------------*/
74
75namespace ADS
76{
77
78/*--------------------------------------------------------------------------*/
79/*-------------------------- CLASS EliasFanoGraph --------------------------*/
80/*--------------------------------------------------------------------------*/
81
84{
85
86/*--------------------------------------------------------------------------*/
87 public:
89 EliasFanoGraph( void ) = default;
90
112 const std::vector< std::vector< std::size_t > > & a );
113
115 [[nodiscard]] std::size_t order( void ) const;
116
118 [[nodiscard]] std::size_t edges( void ) const;
119
123 [[nodiscard]] std::size_t outdegree( std::size_t u ) const;
124
128 [[nodiscard]] std::size_t successor( std::size_t u , std::size_t i ) const;
129
132 [[nodiscard]] std::vector< std::size_t > successors( std::size_t u ) const;
133
137 [[nodiscard]] bool hasEdge( std::size_t u , std::size_t v ) const;
138
140 [[nodiscard]] std::size_t sizeInBits( void ) const;
141
142/*----------------------------- THE PERSISTENCE ----------------------------*/
143
145 static constexpr std::string_view persistName = "EliasFanoGraph";
146
149 template< class A >
150 void persist( A & a );
151
152/*--------------------------------------------------------------------------*/
153 private:
154 std::size_t f_n = 0;
156 EliasFano f_edges;
158 EliasFano f_start;
159
160 }; // end( class EliasFanoGraph )
161
162/*--------------------------------------------------------------------------*/
163
164} // end( namespace ADS )
165
166/*--------------------------------------------------------------------------*/
167/*-------------------------- IMPLEMENTATION --------------------------------*/
168/*--------------------------------------------------------------------------*/
169
170#include "ADS/succinct/impl/EliasFanoGraph.tpp"
171
172/*--------------------------------------------------------------------------*/
173
174#endif /* EliasFanoGraph.h included */
175
176/*--------------------------------------------------------------------------*/
177/*------------------------ End File EliasFanoGraph.h -----------------------*/
178/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The Elias-Fano representation of a non-decreasing sequence of integers in (chapters 11,...
std::vector< std::size_t > successors(std::size_t u) const
the successors of , in increasing order, by successor()
std::size_t successor(std::size_t u, std::size_t i) const
the -th successor of , from 0, i.e.,
static constexpr std::string_view persistName
the name of the structure in a file [see Persistence.h]
Definition EliasFanoGraph.h:145
std::size_t order(void) const
the number of nodes,
std::size_t edges(void) const
the number of edges,
std::size_t sizeInBits(void) const
the bits of the two sequences, with their directories
EliasFanoGraph(void)=default
the graph with no node
std::size_t outdegree(std::size_t u) const
the number of successors of ,
EliasFanoGraph(const std::vector< std::vector< std::size_t > > &a)
the graph of the adjacency lists , the node having the successors
bool hasEdge(std::size_t u, std::size_t v) const
whether is an edge, i.e., whether is in the sequence of the edges
void persist(A &a)
the members written to, or read from, the archive [see Persistence.h]
BasicEliasFano< false > EliasFano
Elias-Fano with the inventories of built in the constructor, the fastest access() and nextGEQ().
Definition EliasFano.h:291
Definition ADT.h:96