SNAP Library , Developer Reference  2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TLocClustStat::TCutInfo Class Reference

#include <ncp.h>

Collaboration diagram for TLocClustStat::TCutInfo:

List of all members.

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

Detailed Description

Definition at line 147 of file ncp.h.


Constructor & Destructor Documentation

Definition at line 152 of file ncp.h.

: Nodes(0), Edges(0), CutSz(0), CutNIdV() { }
TLocClustStat::TCutInfo::TCutInfo ( const int &  ClustNodes,
const int &  EdgesInside,
const int &  CutSize 
) [inline]

Definition at line 153 of file ncp.h.

: Nodes(ClustNodes), Edges(EdgesInside), CutSz(CutSize) { }
TLocClustStat::TCutInfo::TCutInfo ( const int &  ClustNodes,
const int &  EdgesInside,
const int &  CutSize,
const TIntV NIdV 
) [inline]

Definition at line 154 of file ncp.h.

                                                                                                   :
      Nodes(ClustNodes), Edges(EdgesInside), CutSz(CutSize), CutNIdV(NIdV) { }
TLocClustStat::TCutInfo::TCutInfo ( const PUNGraph G,
const TIntV ClustNIdV,
bool  TakeNIdV = false 
) [inline]

Definition at line 156 of file ncp.h.

References CutNIdV, CutSz, Edges, TSnap::GetEdgesInOut(), and TInt::Val.

                                                                             : Nodes(ClustNIdV.Len()) {
      TSnap::GetEdgesInOut(G, ClustNIdV, Edges.Val, CutSz.Val); if(TakeNIdV){CutNIdV=ClustNIdV;} }

Here is the call graph for this function:

TLocClustStat::TCutInfo::TCutInfo ( const TCutInfo CS) [inline]

Definition at line 158 of file ncp.h.

: Nodes(CS.Nodes), Edges(CS.Edges), CutSz(CS.CutSz), CutNIdV(CS.CutNIdV) { }

Member Function Documentation

double TLocClustStat::TCutInfo::GetCutRatio ( const int &  GNodes) const [inline]

Definition at line 167 of file ncp.h.

References CutSz, and Nodes.

Referenced by TLocClustStat::SaveTxtInfo().

{ return double(CutSz)/double(Nodes*(GNodes-Nodes)); }        // cut ratio (external density)

Here is the caller graph for this function:

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; }

Here is the caller graph for this function:

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; }

Here is the caller graph for this function:

double TLocClustStat::TCutInfo::GetExpansion ( ) const [inline]

Definition at line 165 of file ncp.h.

References CutSz, and Nodes.

Referenced by TLocClustStat::SaveTxtInfo().

{ return Nodes<2 ? 1.0 : double(CutSz)/double(Nodes); }                       // expansion

Here is the caller graph for this function:

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)

Here is the call graph for this function:

Here is the caller graph for this function:

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 >::Empty(), TMom::GetDecile(), TUNGraph::TNodeI::GetDeg(), TMom::GetMean(), TMom::GetMedian(), TMom::GetMx(), TUNGraph::TNodeI::GetNbrNId(), TUNGraph::GetNI(), IAssert, TVec< TVal >::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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

double TLocClustStat::TCutInfo::GetIntDens ( ) const [inline]

Definition at line 166 of file ncp.h.

References Edges, and Nodes.

Referenced by TLocClustStat::SaveTxtInfo().

{ return 1.0 - ((Nodes<2) ? 0 : 2.0*double(Edges)/double(Nodes*(Nodes-1))); }   // internal density

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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; }

Here is the caller graph for this function:

double TLocClustStat::TCutInfo::GetNormCut ( const int &  GEdges) const [inline]

Definition at line 168 of file ncp.h.

References CutSz, GetPhi(), and GetVol().

Referenced by TLocClustStat::SaveTxtInfo().

{ return GetPhi() + double(CutSz)/double(2*GEdges-GetVol()); } // normalized cut

Here is the call graph for this function:

Here is the caller graph for this function:

double TLocClustStat::TCutInfo::GetPhi ( ) const [inline]

Definition at line 164 of file ncp.h.

References CutSz, and Edges.

Referenced by TLocClustStat::AddToBestCutH(), TLocClustStat::FindBestCut(), GetNormCut(), operator<(), TLocClustStat::PlotPhiInOut(), TLocClustStat::Run(), and TLocClustStat::SaveTxtInfo().

{ return double(CutSz)/double(2*Edges+CutSz); }                                     // conductance

Here is the caller graph for this function:

int TLocClustStat::TCutInfo::GetVol ( ) const [inline]

Definition at line 161 of file ncp.h.

References CutSz, and Edges.

Referenced by TLocClustStat::FindBestCut(), GetNormCut(), and TLocClustStat::PlotPhiInOut().

{ return 2*Edges+CutSz; }

Here is the caller graph for this function:

bool TLocClustStat::TCutInfo::operator< ( const TCutInfo CS) const [inline]

Definition at line 173 of file ncp.h.

References GetPhi().

{ return GetPhi() < CS.GetPhi(); }

Here is the call graph for this function:


Member Data Documentation


The documentation for this class was generated from the following files: