00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SH_SAMPLEVALUEADJACENCYLIST_H
00022 #define SH_SAMPLEVALUEADJACENCYLIST_H
00023
00024 #include <vector>
00025
00026 #include "SampleValue.h"
00027 #include "common.h"
00028
00033 class SampleValueAdjacencyList {
00034 public:
00038 SampleValueAdjacencyList (SampleValueLabel numsvs) ;
00039
00040 std::vector<SampleValue*>& operator[] (const SampleValueLabel lbl)
00041 { return AdjacencyList[lbl] ; } ;
00042
00043 std::vector<SampleValue*>& operator[] (const SampleValue* sv)
00044 { return AdjacencyList[sv->getLabel()] ; } ;
00045
00046 unsigned long getNumRows (void) const
00047 { return AdjacencyList.size() ; } ;
00048
00052 bool operator== (const SampleValueAdjacencyList& sval) ;
00053
00057 void sort (void) ;
00058
00059 private:
00060 std::vector<std::vector<SampleValue*> > AdjacencyList ;
00061
00062 void quicksort (std::vector<SampleValue*>& oppneighs, UWORD32* distances, unsigned int l, unsigned int r) ;
00067 unsigned int partition (std::vector<SampleValue*>& oppneighs, UWORD32* distances, unsigned int l, unsigned int r, UWORD32 x) ;
00068 void swap (std::vector<SampleValue*>& oppneighs, UWORD32* distances, unsigned int i, unsigned int j) ;
00069 } ;
00070
00071 #endif // ndef SH_SAMPLEVALUEADJACENCYLIST_H