| 
    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 
   | 
  
  
  
 
#include <ncp.h>

Public Member Functions | |
| TCutInfo () | |
| TCutInfo (const int &ClustNodes, const int &EdgesInside, const int &CutSize) | |
| TCutInfo (const int &ClustNodes, const int &EdgesInside, const int &CutSize, const TIntV &NIdV) | |
| TCutInfo (const PUNGraph &G, const TIntV &ClustNIdV, bool TakeNIdV=false) | |
| TCutInfo (const TCutInfo &CS) | |
| int | GetNodes () const | 
| int | GetEdges () const | 
| int | GetVol () const | 
| int | GetCutSz () const | 
| double | GetPhi () const | 
| double | GetExpansion () const | 
| double | GetIntDens () const | 
| double | GetCutRatio (const int &GNodes) const | 
| double | GetNormCut (const int &GEdges) const | 
| double | GetFracDegOut (const PUNGraph &Graph, double &MxFrac, double &AvgFrac, double &MedianFrac, double &Pct9Frac, double &Flake) const | 
| double | GetModular (const int &GEdges) const | 
| double | GetModRat (const int &GEdges) const | 
| double | GetExpEdgesIn (const int &GEdges) const | 
| bool | operator< (const TCutInfo &CS) const | 
Public Attributes | |
| TInt | Nodes | 
| TInt | Edges | 
| TInt | CutSz | 
| TIntV | CutNIdV | 
| TLocClustStat::TCutInfo::TCutInfo | ( | ) |  [inline] | 
        
| TLocClustStat::TCutInfo::TCutInfo | ( | const int & | ClustNodes, | 
| const int & | EdgesInside, | ||
| const int & | CutSize | ||
| ) |  [inline] | 
        
| TLocClustStat::TCutInfo::TCutInfo | ( | const int & | ClustNodes, | 
| const int & | EdgesInside, | ||
| const int & | CutSize, | ||
| const TIntV & | NIdV | ||
| ) |  [inline] | 
        
| TLocClustStat::TCutInfo::TCutInfo | ( | const PUNGraph & | G, | 
| const TIntV & | ClustNIdV, | ||
| bool | TakeNIdV = false  | 
        ||
| ) |  [inline] | 
        
| TLocClustStat::TCutInfo::TCutInfo | ( | const TCutInfo & | CS | ) |  [inline] | 
        
| double TLocClustStat::TCutInfo::GetCutRatio | ( | const int & | GNodes | ) |  const [inline] | 
        
| int TLocClustStat::TCutInfo::GetCutSz | ( | ) |  const [inline] | 
        
Definition at line 162 of file ncp.h.
References CutSz.
Referenced by TLocClustStat::AddToBestCutH(), TLocClustStat::FindBestCut(), and TLocClustStat::PlotPhiInOut().
{ return CutSz; }

| int TLocClustStat::TCutInfo::GetEdges | ( | ) |  const [inline] | 
        
Definition at line 160 of file ncp.h.
References Edges.
Referenced by TLocClustStat::AddToBestCutH(), and TLocClustStat::PlotPhiInOut().
{ return Edges; }

| double TLocClustStat::TCutInfo::GetExpansion | ( | ) |  const [inline] | 
        
| double TLocClustStat::TCutInfo::GetExpEdgesIn | ( | const int & | GEdges | ) |  const [inline] | 
        
Definition at line 172 of file ncp.h.
References CutSz, Edges, and TMath::Sqr().
Referenced by GetModRat(), GetModular(), and TLocClustStat::SaveTxtInfo().
{ return TMath::Sqr(2.0*Edges+CutSz)/(2.0*GEdges); }        // expected edges inside (sum of degrees on nodes inside)^2/(2*E)


| double TLocClustStat::TCutInfo::GetFracDegOut | ( | const PUNGraph & | Graph, | 
| double & | MxFrac, | ||
| double & | AvgFrac, | ||
| double & | MedianFrac, | ||
| double & | Pct9Frac, | ||
| double & | Flake | ||
| ) | const | 
Definition at line 245 of file ncp.cpp.
References TMom::Add(), THashSet< TKey, THashFunc >::AddKey(), CutNIdV, TMom::Def(), TVec< TVal, TSizeTy >::Empty(), TMom::GetDecile(), TUNGraph::TNodeI::GetDeg(), TMom::GetMean(), TMom::GetMedian(), TMom::GetMx(), TUNGraph::TNodeI::GetNbrNId(), TUNGraph::GetNI(), IAssert, TVec< TVal, TSizeTy >::Len(), and Nodes.
Referenced by TLocClustStat::SaveTxtInfo().
                                                                                                                                                             {
  if (CutNIdV.Empty()) {
    IAssert(Nodes<100 || ! CutNIdV.Empty());
    MxFrac=1; AvgFrac=1; MedianFrac=1; Pct9Frac=1; Flake=1; 
    return 1;
  }
  TMom FracDegMom;
  TIntSet InNIdSet(CutNIdV.Len());
  int NHalfIn=0;
  for (int i = 0; i < CutNIdV.Len(); i++) { 
    InNIdSet.AddKey(CutNIdV[i]); }
  for (int n = 0; n < CutNIdV.Len(); n++) {
    const TUNGraph::TNodeI NI = Graph->GetNI(CutNIdV[n]);
    int EdgesOut = 0;
    for (int i = 0; i < NI.GetDeg(); i++) {
      if (! InNIdSet.IsKey(NI.GetNbrNId(i))) { EdgesOut++; }
    }
    const double FracOut = EdgesOut/double(NI.GetDeg());
    if (FracOut <= 0.5) { NHalfIn++; }
    FracDegMom.Add(FracOut);
  }
  FracDegMom.Def();
  MxFrac = FracDegMom.GetMx();
  AvgFrac = FracDegMom.GetMean();
  MedianFrac = FracDegMom.GetMedian();
  Pct9Frac = FracDegMom.GetDecile(9);
  Flake = 1.0 - double(NHalfIn)/double(CutNIdV.Len());
  return MxFrac;
}


| double TLocClustStat::TCutInfo::GetIntDens | ( | ) |  const [inline] | 
        
| double TLocClustStat::TCutInfo::GetModRat | ( | const int & | GEdges | ) |  const [inline] | 
        
Definition at line 171 of file ncp.h.
References Edges, and GetExpEdgesIn().
Referenced by TLocClustStat::SaveTxtInfo().
{ return (2.0*Edges) / GetExpEdgesIn(GEdges); }                 // modularity ratio


| double TLocClustStat::TCutInfo::GetModular | ( | const int & | GEdges | ) |  const [inline] | 
        
Definition at line 170 of file ncp.h.
References Edges, and GetExpEdgesIn().
Referenced by TLocClustStat::AddToBestCutH(), and TLocClustStat::SaveTxtInfo().
{ return (2.0*Edges - GetExpEdgesIn(GEdges)) / (2.0*GEdges); } // modularity


| int TLocClustStat::TCutInfo::GetNodes | ( | ) |  const [inline] | 
        
Definition at line 159 of file ncp.h.
References Nodes.
Referenced by TLocClustStat::AddToBestCutH(), TLocClustStat::FindBestCut(), and TLocClustStat::PlotPhiInOut().
{ return Nodes; }

| double TLocClustStat::TCutInfo::GetNormCut | ( | const int & | GEdges | ) |  const [inline] | 
        
| double TLocClustStat::TCutInfo::GetPhi | ( | ) |  const [inline] | 
        
Definition at line 164 of file ncp.h.
Referenced by TLocClustStat::AddToBestCutH(), TLocClustStat::FindBestCut(), GetNormCut(), operator<(), TLocClustStat::PlotPhiInOut(), TLocClustStat::Run(), and TLocClustStat::SaveTxtInfo().

| int TLocClustStat::TCutInfo::GetVol | ( | ) |  const [inline] | 
        
Definition at line 161 of file ncp.h.
Referenced by TLocClustStat::FindBestCut(), GetNormCut(), and TLocClustStat::PlotPhiInOut().

| bool TLocClustStat::TCutInfo::operator< | ( | const TCutInfo & | CS | ) |  const [inline] | 
        
Definition at line 150 of file ncp.h.
Referenced by TLocClustStat::FindBestCut(), GetFracDegOut(), TLocClustStat::PlotPhiInOut(), TLocClustStat::Run(), and TCutInfo().
Definition at line 149 of file ncp.h.
Referenced by GetCutRatio(), GetCutSz(), GetExpansion(), GetExpEdgesIn(), GetNormCut(), GetPhi(), GetVol(), TLocClustStat::Run(), TLocClustStat::SaveTxtInfo(), and TCutInfo().
Definition at line 149 of file ncp.h.
Referenced by GetEdges(), GetExpEdgesIn(), GetIntDens(), GetModRat(), GetModular(), GetPhi(), GetVol(), TLocClustStat::Run(), TLocClustStat::SaveTxtInfo(), and TCutInfo().
Definition at line 149 of file ncp.h.
Referenced by GetCutRatio(), GetExpansion(), GetFracDegOut(), GetIntDens(), GetNodes(), and TLocClustStat::SaveTxtInfo().