ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ListRanking.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*-------------------------- File ListRanking.h ----------------------------*/
3/*--------------------------------------------------------------------------*/
92/*--------------------------------------------------------------------------*/
93/*----------------------------- DEFINITIONS --------------------------------*/
94/*--------------------------------------------------------------------------*/
95
96#ifndef __ADS_ListRanking
97 #define __ADS_ListRanking
98/* self-identification: #endif constant */
99
100/*--------------------------------------------------------------------------*/
101/*------------------------------ INCLUDES ----------------------------------*/
102/*--------------------------------------------------------------------------*/
103
104#include "ADS/Contract.h"
108
109#include <algorithm>
110#include <bit>
111#include <cstddef>
112#include <cstdint>
113#include <utility>
114#include <vector>
115
116/*--------------------------------------------------------------------------*/
117/*--------------------------- NAMESPACE ------------------------------------*/
118/*--------------------------------------------------------------------------*/
119
120namespace ADS
121{
122
126[[nodiscard]] inline bool isList( const std::vector< std::size_t > & succ );
127
145[[nodiscard]] inline std::vector< std::size_t >
146listRank( const std::vector< std::size_t > & succ );
147
170[[nodiscard]] inline std::vector< std::size_t >
171listRankPointerJumping( const std::vector< std::size_t > & succ ,
172 std::size_t * rounds = nullptr );
173
189template< class R >
190std::vector< bool >
191randomIndependentSet( const std::vector< std::size_t > & succ , R & g );
192
219[[nodiscard]] inline std::vector< int >
220deterministicCoinTossing( const std::vector< std::size_t > & succ ,
221 std::size_t * rounds = nullptr );
222
242[[nodiscard]] inline std::vector< bool >
243independentSetOfColors( const std::vector< std::size_t > & succ ,
244 const std::vector< int > & color );
245
279template< class R >
280std::vector< std::size_t >
281listRankIndependentSet( const std::vector< std::size_t > & succ , R & g ,
282 bool deterministic = false ,
283 std::size_t * levels = nullptr );
284
315template< class T , class Op >
317 const DiskFile< T > & A ,
318 const DiskFile< std::pair< std::size_t , std::size_t > > & ops , Op op ,
319 DiskFile< T > & out );
320
349 std::size_t * rounds = nullptr );
350
381template< class R >
383 DiskFile< std::size_t > & rank , R & g ,
384 std::size_t * levels = nullptr );
385
386/*--------------------------------------------------------------------------*/
387
388} // end( namespace ADS )
389
390/*--------------------------------------------------------------------------*/
391/*-------------------------- IMPLEMENTATION --------------------------------*/
392/*--------------------------------------------------------------------------*/
393
394#include "ADS/external/impl/ListRanking.tpp"
395
396/*--------------------------------------------------------------------------*/
397
398#endif /* ListRanking.h included */
399
400/*--------------------------------------------------------------------------*/
401/*------------------------- End File ListRanking.h -------------------------*/
402/*--------------------------------------------------------------------------*/
The binary search of section 1.2 in a sorted vector : is compared with the middle item of the part ...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The sort of atomic items in the two-level memory [see TwoLevelMemory.h], by merging and by distribut...
The two-level memory model of Aggarwal and Vitter, simulated so that the algorithms of the external m...
a file of items on the disk of the model, in blocks of items
Definition TwoLevelMemory.h:199
void parallelStep(const DiskFile< T > &A, const DiskFile< std::pair< std::size_t, std::size_t > > &ops, Op op, DiskFile< T > &out)
for each pair of ops, for the of no pair, the values of read before any change; two sorts and thr...
bool isList(const std::vector< std::size_t > &succ)
whether is a list: one tail with , and every item reached from the only item that is no successor
std::vector< bool > randomIndependentSet(const std::vector< std::size_t > &succ, R &g)
the heads whose successor shows tails, a coin per item drawn by g
void externalPointerJumping(const DiskFile< std::size_t > &succ, DiskFile< std::size_t > &rank, std::size_t *rounds=nullptr)
the ranks of the list succ into rank, by pointer jumping, each round a parallelStep(); the rounds go ...
std::vector< std::size_t > listRankIndependentSet(const std::vector< std::size_t > &succ, R &g, bool deterministic=false, std::size_t *levels=nullptr)
the distances from the tail, by removing independent sets, random ones drawn by g or,...
std::vector< bool > independentSetOfColors(const std::vector< std::size_t > &succ, const std::vector< int > &color)
the items whose color is smaller than those of their neighbors, the tail excluded and not counted as ...
void externalListRank(const DiskFile< std::size_t > &succ, DiskFile< std::size_t > &rank, R &g, std::size_t *levels=nullptr)
the ranks of the list succ into rank, by removing random independent sets drawn by g; the levels of t...
std::vector< int > deterministicCoinTossing(const std::vector< std::size_t > &succ, std::size_t *rounds=nullptr)
three colors in , by deterministic coin tossing; the rounds down to six colors go to *rounds,...
std::vector< std::size_t > listRank(const std::vector< std::size_t > &succ)
the distances from the tail, by the predecessors and a walk back
std::vector< std::size_t > listRankPointerJumping(const std::vector< std::size_t > &succ, std::size_t *rounds=nullptr)
the distances from the tail, by pointer jumping; the rounds go to *rounds, if given
Definition ADT.h:96