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
TBPGraph Class Reference

List of all members.

Classes

class  TEdgeI
 Edge iterator. Only forward iteration (operator++) is supported. More...
class  TNode
class  TNodeI
 Node iterator. Only forward iteration (operator++) is supported. More...

Public Types

enum  TNodeTy { bgsUndef, bgsLeft, bgsRight, bgsBoth }
typedef TBPGraph TNet
typedef TPt< TBPGraphPNet

Public Member Functions

 TBPGraph ()
 TBPGraph (const int &Nodes, const int &Edges)
 Constructor that reserves enough memory for a graph of Nodes (LeftNodes+RightNodes) nodes and Edges edges.
 TBPGraph (const TBPGraph &BPGraph)
 !! Reserve(Nodes, Edges); }
 TBPGraph (TSIn &SIn)
 Constructor for loading the graph from a (binary) stream SIn.
void Save (TSOut &SOut) const
 Saves the graph to a (binary) stream SOut.
bool HasFlag (const TGraphFlag &Flag) const
 Allows for run-time checking the type of the graph (see the TGraphFlag for flags).
TBPGraphoperator= (const TBPGraph &BPGraph)
int GetNodes () const
 Returns the total number of nodes in the graph.
int GetLNodes () const
 Returns the number of nodes on the 'left' side of the biparite graph.
int GetRNodes () const
 Returns the number of nodes on the 'right' side of the biparite graph.
int AddNode (int NId=-1, const bool &LeftNode=true)
 Adds a node of ID NId to the graph.
int AddNode (const TNodeI &NodeI)
 Adds a node of ID NodeI.GetId() to the graph.
void DelNode (const int &NId)
 Deletes node of ID NId from the graph.
void DelNode (const TNode &NodeI)
 Deletes node of ID NodeI.GetId() from the graph.
bool IsNode (const int &NId) const
 Tests whether ID NId is a node.
bool IsLNode (const int &NId) const
 Tests whether ID NId is a 'left' side node.
bool IsRNode (const int &NId) const
 Tests whether ID NId is a 'right' side node.
int GetMxNId () const
 Returns the maximum id of a any node in the graph.
TNodeI BegNI () const
 Returns an iterator referring to the first node in the graph.
TNodeI EndNI () const
 Returns an iterator referring to the past-the-end node in the graph.
TNodeI GetNI (const int &NId) const
 Returns an iterator referring to the node of ID NId in the graph.
TNodeI BegLNI () const
 Returns an iterator referring to the first 'left' node in the graph.
TNodeI EndLNI () const
 Returns an iterator referring to the past-the-end 'left' node in the graph.
TNodeI BegRNI () const
 Returns an iterator referring to the first 'right' node in the graph.
TNodeI EndRNI () const
 Returns an iterator referring to the past-the-end 'right' node in the graph.
int GetEdges () const
 Returns the number of edges in the graph.
int AddEdge (const int &LeftNId, const int &RightNId)
 Adds an edge between a node LeftNId on the left and a node RightNId on the right side of the bipartite graph.
int AddEdge (const TEdgeI &EdgeI)
 Adds an edge between EdgeI.GetLNId() and EdgeI.GetRNId() to the graph.
void DelEdge (const int &LeftNId, const int &RightNId)
 Deletes an edge between a node LeftNId on the left and a node RightNId on the right side of the bipartite graph.
bool IsEdge (const int &LeftNId, const int &RightNId) const
 Tests whether an edge between node IDs LeftNId and RightNId exists in the graph.
TEdgeI BegEI () const
 Returns an iterator referring to the first edge in the graph.
TEdgeI EndEI () const
 Returns an iterator referring to the past-the-end edge in the graph.
TEdgeI GetEI (const int &EId) const
 Not supported/implemented!
TEdgeI GetEI (const int &LeftNId, const int &RightNId) const
 Returns an iterator referring to edge (LeftNId, RightNId) in the graph.
int GetRndNId (TRnd &Rnd=TInt::Rnd)
 Returns an ID of a random node in the graph.
int GetRndLNId (TRnd &Rnd=TInt::Rnd)
 Returns an ID of a random 'left' node in the graph.
int GetRndRNId (TRnd &Rnd=TInt::Rnd)
 Returns an ID of a random 'right' node in the graph.
TNodeI GetRndNI (TRnd &Rnd=TInt::Rnd)
 Returns an interator referring to a random node in the graph.
void GetNIdV (TIntV &NIdV) const
 Gets a vector IDs of all nodes in the bipartite graph.
void GetLNIdV (TIntV &NIdV) const
 Gets a vector IDs of all 'left' nodes in the bipartite graph.
void GetRNIdV (TIntV &NIdV) const
 Gets a vector IDs of all 'right' nodes in the bipartite graph.
bool Empty () const
 Tests whether the bipartite graph is empty (has zero nodes).
void Clr ()
 Deletes all nodes and edges from the bipartite graph.
void Reserve (const int &Nodes, const int &Edges)
 Reserves memory for a biparite graph of Nodes nodes and Edges edges.
void Defrag (const bool &OnlyNodeLinks=false)
 Defragments the biparite graph.
bool IsOk (const bool &ThrowExcept=true) const
 Checks the bipartite graph data structure for internal consistency.
void Dump (FILE *OutF=stdout) const
 Print the biparite graph in a human readable form to an output stream OutF.

Static Public Member Functions

static PBPGraph New ()
 Static constructor that returns a pointer to the graph. Call: PBPGraph BPGraph = TBPGraph::New();.
static PBPGraph New (const int &Nodes, const int &Edges)
 Static constructor that returns a pointer to the graph and reserves enough memory for Nodes nodes and Edges edges.
static PBPGraph Load (TSIn &SIn)
 Static constructor that loads the graph from a stream SIn and returns a pointer to it.
static PBPGraph GetSmallGraph ()
 Returns a small graph on 2 'left', 3 'right' nodes and 4 edges.

Friends

class TPt< TBPGraph >

Detailed Description

Bipartite graph.


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
bgsUndef 
bgsLeft 
bgsRight 
bgsBoth 

Constructor & Destructor Documentation

TBPGraph::TBPGraph ( ) [inline]
TBPGraph::TBPGraph ( const int &  Nodes,
const int &  Edges 
) [inline, explicit]

Constructor that reserves enough memory for a graph of Nodes (LeftNodes+RightNodes) nodes and Edges edges.

TBPGraph::TBPGraph ( const TBPGraph BPGraph) [inline]

!! Reserve(Nodes, Edges); }

TBPGraph::TBPGraph ( TSIn SIn) [inline]

Constructor for loading the graph from a (binary) stream SIn.


Member Function Documentation

int TBPGraph::AddEdge ( const int &  LeftNId,
const int &  RightNId 
)

Adds an edge between a node LeftNId on the left and a node RightNId on the right side of the bipartite graph.

int TBPGraph::AddEdge ( const TEdgeI EdgeI) [inline]

Adds an edge between EdgeI.GetLNId() and EdgeI.GetRNId() to the graph.

int TBPGraph::AddNode ( int  NId = -1,
const bool &  LeftNode = true 
)

Adds a node of ID NId to the graph.

int TBPGraph::AddNode ( const TNodeI NodeI) [inline]

Adds a node of ID NodeI.GetId() to the graph.

TEdgeI TBPGraph::BegEI ( ) const [inline]

Returns an iterator referring to the first edge in the graph.

TNodeI TBPGraph::BegLNI ( ) const [inline]

Returns an iterator referring to the first 'left' node in the graph.

TNodeI TBPGraph::BegNI ( ) const [inline]

Returns an iterator referring to the first node in the graph.

TNodeI TBPGraph::BegRNI ( ) const [inline]

Returns an iterator referring to the first 'right' node in the graph.

void TBPGraph::Clr ( ) [inline]

Deletes all nodes and edges from the bipartite graph.

void TBPGraph::Defrag ( const bool &  OnlyNodeLinks = false)

Defragments the biparite graph.

void TBPGraph::DelEdge ( const int &  LeftNId,
const int &  RightNId 
)

Deletes an edge between a node LeftNId on the left and a node RightNId on the right side of the bipartite graph.

void TBPGraph::DelNode ( const int &  NId)

Deletes node of ID NId from the graph.

void TBPGraph::DelNode ( const TNode NodeI) [inline]

Deletes node of ID NodeI.GetId() from the graph.

void TBPGraph::Dump ( FILE *  OutF = stdout) const

Print the biparite graph in a human readable form to an output stream OutF.

bool TBPGraph::Empty ( ) const [inline]

Tests whether the bipartite graph is empty (has zero nodes).

TEdgeI TBPGraph::EndEI ( ) const [inline]

Returns an iterator referring to the past-the-end edge in the graph.

TNodeI TBPGraph::EndLNI ( ) const [inline]

Returns an iterator referring to the past-the-end 'left' node in the graph.

TNodeI TBPGraph::EndNI ( ) const [inline]

Returns an iterator referring to the past-the-end node in the graph.

TNodeI TBPGraph::EndRNI ( ) const [inline]

Returns an iterator referring to the past-the-end 'right' node in the graph.

int TBPGraph::GetEdges ( ) const

Returns the number of edges in the graph.

TEdgeI TBPGraph::GetEI ( const int &  EId) const

Not supported/implemented!

TBPGraph::TEdgeI TBPGraph::GetEI ( const int &  LeftNId,
const int &  RightNId 
) const

Returns an iterator referring to edge (LeftNId, RightNId) in the graph.

void TBPGraph::GetLNIdV ( TIntV NIdV) const

Gets a vector IDs of all 'left' nodes in the bipartite graph.

int TBPGraph::GetLNodes ( ) const [inline]

Returns the number of nodes on the 'left' side of the biparite graph.

int TBPGraph::GetMxNId ( ) const [inline]

Returns the maximum id of a any node in the graph.

TNodeI TBPGraph::GetNI ( const int &  NId) const [inline]

Returns an iterator referring to the node of ID NId in the graph.

void TBPGraph::GetNIdV ( TIntV NIdV) const

Gets a vector IDs of all nodes in the bipartite graph.

int TBPGraph::GetNodes ( ) const [inline]

Returns the total number of nodes in the graph.

Returns an ID of a random 'left' node in the graph.

TNodeI TBPGraph::GetRndNI ( TRnd Rnd = TInt::Rnd) [inline]

Returns an interator referring to a random node in the graph.

Returns an ID of a random node in the graph.

Returns an ID of a random 'right' node in the graph.

void TBPGraph::GetRNIdV ( TIntV NIdV) const

Gets a vector IDs of all 'right' nodes in the bipartite graph.

int TBPGraph::GetRNodes ( ) const [inline]

Returns the number of nodes on the 'right' side of the biparite graph.

Returns a small graph on 2 'left', 3 'right' nodes and 4 edges.

bool TBPGraph::HasFlag ( const TGraphFlag Flag) const

Allows for run-time checking the type of the graph (see the TGraphFlag for flags).

bool TBPGraph::IsEdge ( const int &  LeftNId,
const int &  RightNId 
) const

Tests whether an edge between node IDs LeftNId and RightNId exists in the graph.

bool TBPGraph::IsLNode ( const int &  NId) const [inline]

Tests whether ID NId is a 'left' side node.

bool TBPGraph::IsNode ( const int &  NId) const [inline]

Tests whether ID NId is a node.

bool TBPGraph::IsOk ( const bool &  ThrowExcept = true) const

Checks the bipartite graph data structure for internal consistency.

bool TBPGraph::IsRNode ( const int &  NId) const [inline]

Tests whether ID NId is a 'right' side node.

static PBPGraph TBPGraph::Load ( TSIn SIn) [inline, static]

Static constructor that loads the graph from a stream SIn and returns a pointer to it.

static PBPGraph TBPGraph::New ( ) [inline, static]

Static constructor that returns a pointer to the graph. Call: PBPGraph BPGraph = TBPGraph::New();.

static PBPGraph TBPGraph::New ( const int &  Nodes,
const int &  Edges 
) [inline, static]

Static constructor that returns a pointer to the graph and reserves enough memory for Nodes nodes and Edges edges.

TBPGraph& TBPGraph::operator= ( const TBPGraph BPGraph) [inline]
void TBPGraph::Reserve ( const int &  Nodes,
const int &  Edges 
)

Reserves memory for a biparite graph of Nodes nodes and Edges edges.

void TBPGraph::Save ( TSOut SOut) const [inline]

Saves the graph to a (binary) stream SOut.


Friends And Related Function Documentation

friend class TPt< TBPGraph > [friend]

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