SNAP Library, User Reference  2012-10-02 12:56:23
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TKCore< PGraph > Class Template Reference

List of all members.

Public Member Functions

 TKCore (const PGraph &_Graph)
int GetCurK () const
int GetNextCore ()
int GetCoreK (const int &K)
int GetCoreNodes () const
 Gets the number of nodes in the K-core (for the current value of K).
int GetCoreEdges () const
 Gets the number of edges in the K-core (for the current value of K).
const TIntVGetNIdV () const
 Returns the IDs of the nodes in the current K-core.
PGraph GetCoreG () const
 Returrns the graph of the current K-core.

Detailed Description

template<class PGraph>
class TKCore< PGraph >

K-Core decomposition of a network. K-core is defined as a maximal subgraph of the original graph where every node points to at least K other nodes. K-core is obtained by repeatedly deleting nodes of degree < K from the graph until no nodes of degree < K exist. If the input graph is directed we treat it as undirected multigraph, i.e., we ignore the edge directions but there may be up to two edges between a pair of nodes. See the kcores example (examples/kcores/kcores.cpp) for how to use the code. For example: for (KCore(Graph); KCore.GetNextCore()!=0; ) { } will produce a sequence of K-cores for K=1...


Constructor & Destructor Documentation

template<class PGraph>
TKCore< PGraph >::TKCore ( const PGraph &  _Graph) [inline]

Member Function Documentation

template<class PGraph >
int TKCore< PGraph >::GetCoreEdges ( ) const

Gets the number of edges in the K-core (for the current value of K).

template<class PGraph>
PGraph TKCore< PGraph >::GetCoreG ( ) const [inline]

Returrns the graph of the current K-core.

template<class PGraph >
int TKCore< PGraph >::GetCoreK ( const int &  K)

Directly generates the core of order K. The function has the same effect as calling GetNextCore() K times.

template<class PGraph>
int TKCore< PGraph >::GetCoreNodes ( ) const [inline]

Gets the number of nodes in the K-core (for the current value of K).

template<class PGraph>
int TKCore< PGraph >::GetCurK ( ) const [inline]

Gets the currrent value of K. For every call of GetNextCore() the value of K increases by 1.

template<class PGraph >
int TKCore< PGraph >::GetNextCore ( )

Returns the number of nodes in the next (K=K+1) core. The function starts with K=1-core and every time we call it it increases the value of K by 1 and generates the core. The function proceeds until GetCoreNodes() returns 0. Return value of the function is the size (the number of nodes) in the K-core (for the current value of K).

template<class PGraph>
const TIntV& TKCore< PGraph >::GetNIdV ( ) const [inline]

Returns the IDs of the nodes in the current K-core.


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