| 
    SNAP Library 2.0, Developer Reference
    2013-05-13 16:33:57
    
   SNAP, a general purpose, high performance system for analysis and manipulation of large networks 
   | 
  
  
  
 
Graph Utilities. More...
#include <util.h>
Static Public Member Functions | |
| static void | GetCdf (const TIntPrV &PdfV, TIntPrV &CdfV) | 
| static void | GetCdf (const TFltPrV &PdfV, TFltPrV &CdfV) | 
| static void | GetCdf (const TIntFltKdV &PdfV, TIntFltKdV &CdfV) | 
| static TIntPrV | GetCdf (const TIntPrV &PdfV) | 
| static TFltPrV | GetCdf (const TFltPrV &PdfV) | 
| static void | GetCCdf (const TIntPrV &PdfV, TIntPrV &CCdfV) | 
| static void | GetCCdf (const TFltPrV &PdfV, TFltPrV &CCdfV) | 
| static void | GetCCdf (const TIntFltKdV &PdfV, TIntFltKdV &CCdfV) | 
| static TIntPrV | GetCCdf (const TIntPrV &PdfV) | 
| static TFltPrV | GetCCdf (const TFltPrV &PdfV) | 
| static void | GetPdf (const TIntPrV &CdfV, TIntPrV &PdfV) | 
| static void | GetPdf (const TFltPrV &CdfV, TFltPrV &PdfV) | 
| static void | GetPdf (const TIntFltKdV &CdfV, TIntFltKdV &PdfV) | 
| static void | Normalize (TFltPrV &PdfV) | 
| static void | Normalize (TIntFltKdV &PdfV) | 
| static void | MakeExpBins (const TFltPrV &XYValV, TFltPrV &ExpXYValV, const double &BinFactor=2, const double &MinYVal=1) | 
| static void | MakeExpBins (const TFltKdV &XYValV, TFltKdV &ExpXYValV, const double &BinFactor=2, const double &MinYVal=1) | 
| static void | MakeExpBins (const TFltV &YValV, TFltV &ExpYValV, const double &BinFactor=1.01) | 
| static void | MakeExpBins (const TIntV &YValV, TIntV &ExpYValV, const double &BinFactor=1.01) | 
| void TGUtil::GetCCdf | ( | const TIntPrV & | PdfV, | 
| TIntPrV & | CCdfV | ||
| ) |  [static] | 
        
Definition at line 33 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
Referenced by GetCCdf(), TSnap::PlotInDegDistr(), and TSnap::PlotOutDegDistr().
                                                        {
  CCdfV = PdfV;
  for (int i = CCdfV.Len()-2; i >= 0; i--) {
    CCdfV[i].Val2 = CCdfV[i+1].Val2 + CCdfV[i].Val2; }
}


| void TGUtil::GetCCdf | ( | const TFltPrV & | PdfV, | 
| TFltPrV & | CCdfV | ||
| ) |  [static] | 
        
Definition at line 39 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
                                                        {
  CCdfV = PdfV;
  for (int i = CCdfV.Len()-2; i >= 0; i--) {
    CCdfV[i].Val2 = CCdfV[i+1].Val2 + CCdfV[i].Val2; }
}

| void TGUtil::GetCCdf | ( | const TIntFltKdV & | PdfV, | 
| TIntFltKdV & | CCdfV | ||
| ) |  [static] | 
        
Definition at line 45 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
                                                              {
  CCdfV = PdfV;
  for (int i = CCdfV.Len()-2; i >= 0; i--) {
    CCdfV[i].Dat = CCdfV[i+1].Dat + CCdfV[i].Dat; }
}

| TIntPrV TGUtil::GetCCdf | ( | const TIntPrV & | PdfV | ) |  [static] | 
        
| TFltPrV TGUtil::GetCCdf | ( | const TFltPrV & | PdfV | ) |  [static] | 
        
| void TGUtil::GetCdf | ( | const TIntPrV & | PdfV, | 
| TIntPrV & | CdfV | ||
| ) |  [static] | 
        
Definition at line 3 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
Referenced by TSnap::TSnapDetail::CalcEffDiamPdf(), and GetCdf().
                                                      {
  CdfV = PdfV;
  for (int i = 1; i < CdfV.Len(); i++) {
    CdfV[i].Val2 = CdfV[i-1].Val2 + CdfV[i].Val2; }
}


| void TGUtil::GetCdf | ( | const TFltPrV & | PdfV, | 
| TFltPrV & | CdfV | ||
| ) |  [static] | 
        
Definition at line 9 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
                                                      {
  CdfV = PdfV;
  for (int i = 1; i < CdfV.Len(); i++) {
    CdfV[i].Val2 = CdfV[i-1].Val2 + CdfV[i].Val2; }
}

| void TGUtil::GetCdf | ( | const TIntFltKdV & | PdfV, | 
| TIntFltKdV & | CdfV | ||
| ) |  [static] | 
        
Definition at line 15 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
                                                            {
  CdfV = PdfV;
  for (int i = 1; i < CdfV.Len(); i++) {
    CdfV[i].Dat = CdfV[i-1].Dat + CdfV[i].Dat; }
}

| TIntPrV TGUtil::GetCdf | ( | const TIntPrV & | PdfV | ) |  [static] | 
        
| TFltPrV TGUtil::GetCdf | ( | const TFltPrV & | PdfV | ) |  [static] | 
        
| void TGUtil::GetPdf | ( | const TIntPrV & | CdfV, | 
| TIntPrV & | PdfV | ||
| ) |  [static] | 
        
Definition at line 63 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
                                                      {
  PdfV = CdfV;
  for (int i = PdfV.Len()-1; i > 0; i--) {
    PdfV[i].Val2 = PdfV[i].Val2 - PdfV[i-1].Val2; }
}

| void TGUtil::GetPdf | ( | const TFltPrV & | CdfV, | 
| TFltPrV & | PdfV | ||
| ) |  [static] | 
        
Definition at line 69 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
                                                      {
  PdfV = CdfV;
  for (int i = PdfV.Len()-1; i > 0; i--) {
    PdfV[i].Val2 = PdfV[i].Val2 - PdfV[i-1].Val2; }
}

| void TGUtil::GetPdf | ( | const TIntFltKdV & | CdfV, | 
| TIntFltKdV & | PdfV | ||
| ) |  [static] | 
        
Definition at line 75 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
                                                            {
  PdfV = CdfV;
  for (int i = PdfV.Len()-1; i > 0; i--) {
    PdfV[i].Dat = PdfV[i].Dat - PdfV[i-1].Dat; }
}

| void TGUtil::MakeExpBins | ( | const TFltPrV & | XYValV, | 
| TFltPrV & | ExpXYValV, | ||
| const double & | BinFactor = 2,  | 
        ||
| const double & | MinYVal = 1  | 
        ||
| ) |  [static] | 
        
Definition at line 99 of file util.cpp.
Referenced by MakeExpBins(), and TSnap::PlotSngVec().
                                                                                                                  {
  TGnuPlot::MakeExpBins(XYValV, ExpXYValV, BinFactor, MinYVal);
}

| void TGUtil::MakeExpBins | ( | const TFltKdV & | XYValV, | 
| TFltKdV & | ExpXYValV, | ||
| const double & | BinFactor = 2,  | 
        ||
| const double & | MinYVal = 1  | 
        ||
| ) |  [static] | 
        
Definition at line 103 of file util.cpp.
References MakeExpBins().
                                                                                                                  {
  TGnuPlot::MakeExpBins(XYValV, ExpXYValV, BinFactor, MinYVal);
}

| void TGUtil::MakeExpBins | ( | const TFltV & | YValV, | 
| TFltV & | ExpYValV, | ||
| const double & | BinFactor = 1.01  | 
        ||
| ) |  [static] | 
        
Definition at line 107 of file util.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Clr(), and TVec< TVal, TSizeTy >::Len().
                                                                                     {
  ExpYValV.Clr(true);
  int prevI=0;
  for (int i = 0; i < YValV.Len(); ) {
    ExpYValV.Add(YValV[i]);
    i = int(i*BinFactor);
    if (i==prevI) { i++; }
    prevI = i;
  }
}

| void TGUtil::MakeExpBins | ( | const TIntV & | YValV, | 
| TIntV & | ExpYValV, | ||
| const double & | BinFactor = 1.01  | 
        ||
| ) |  [static] | 
        
Definition at line 118 of file util.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Clr(), and TVec< TVal, TSizeTy >::Len().
                                                                                     {
  ExpYValV.Clr(true);
  int prevI=0;
  for (int i = 0; i < YValV.Len(); ) {
    ExpYValV.Add(YValV[i]);
    i = int(i*BinFactor);
    if (i==prevI) { i++; }
    prevI = i;
  }
}

| void TGUtil::Normalize | ( | TFltPrV & | PdfV | ) |  [static] | 
        
Definition at line 81 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
                                    {
  double Sum = 0.0;
  for (int i = 0; i < PdfV.Len(); i++) {
    Sum += PdfV[i].Val2; }
  if (Sum <= 0.0) { return; }
  for (int i = 0; i < PdfV.Len(); i++) {
    PdfV[i].Val2 /= Sum; }
}

| void TGUtil::Normalize | ( | TIntFltKdV & | PdfV | ) |  [static] | 
        
Definition at line 90 of file util.cpp.
References TVec< TVal, TSizeTy >::Len().
                                       {
  double Sum = 0.0;
  for (int i = 0; i < PdfV.Len(); i++) {
    Sum += PdfV[i].Dat; }
  if (Sum <= 0.0) { return; }
  for (int i = 0; i < PdfV.Len(); i++) {
    PdfV[i].Dat /= Sum; }
}
