dai::ClusterGraph Class Reference

A ClusterGraph is a hypergraph with variables as nodes, and "clusters" (sets of variables) as hyperedges. More...

#include <dai/clustergraph.h>

List of all members.

Public Types

typedef BipartiteGraph::Neighbor Neighbor
 Shorthand for BipartiteGraph::Neighbor.
typedef BipartiteGraph::Edge Edge
 Shorthand for BipartiteGraph::Edge.

Public Member Functions

Constructors and destructors
 ClusterGraph ()
 Default constructor.
 ClusterGraph (const std::vector< VarSet > &cls)
 Construct from vector of VarSet 's.
Queries
const std::vector< VarSet > & toVector () const
 Returns a constant reference to the clusters.
size_t size () const
 Returns number of clusters.
size_t findVar (const Var &n) const
 Returns the index of variable n.
VarSet Delta (size_t i) const
 Returns union of clusters that contain the i 'th variable.
VarSet delta (size_t i) const
 Returns union of clusters that contain the i 'th (except this variable itself).
bool adj (size_t i1, size_t i2) const
 Returns true if variables with indices i1 and i2 are adjacent, i.e., both contained in the same cluster.
bool isMaximal (size_t I) const
 Returns true if cluster I is not contained in a larger cluster.
Operations
void insert (const VarSet &cl)
 Inserts a cluster (if it does not already exist).
ClusterGrapheraseNonMaximal ()
 Erases all clusters that are not maximal.
ClusterGrapheraseSubsuming (size_t i)
 Erases all clusters that contain the i 'th variable.
Variable elimination
template<class EliminationChoice>
ClusterGraph VarElim (EliminationChoice f) const
 Performs Variable Elimination, only keeping track of the interactions that are created along the way.
size_t eliminationCost (size_t i) const
 Calculates cost of eliminating the i 'th variable.
ClusterGraph VarElim (const std::vector< Var > &ElimSeq) const
 Performs Variable Elimination, only keeping track of the interactions that are created along the way.
ClusterGraph VarElim_MinFill () const
 Performs Variable Elimination using the "MinFill" heuristic.

Public Attributes

BipartiteGraph G
 Stores the neighborhood structure.
std::vector< Varvars
 Stores the variables corresponding to the nodes.
std::vector< VarSetclusters
 Stores the clusters corresponding to the hyperedges.

Friends

Input/Ouput
std::ostream & operator<< (std::ostream &os, const ClusterGraph &cl)
 Writes a ClusterGraph to an output stream.


Detailed Description

A ClusterGraph is a hypergraph with variables as nodes, and "clusters" (sets of variables) as hyperedges.

It is implemented as a bipartite graph with variable (Var) nodes and cluster (VarSet) nodes.


Member Typedef Documentation

Shorthand for BipartiteGraph::Neighbor.

Shorthand for BipartiteGraph::Edge.


Constructor & Destructor Documentation

dai::ClusterGraph::ClusterGraph (  )  [inline]

Default constructor.

dai::ClusterGraph::ClusterGraph ( const std::vector< VarSet > &  cls  ) 

Construct from vector of VarSet 's.


Member Function Documentation

const std::vector<VarSet>& dai::ClusterGraph::toVector (  )  const [inline]

Returns a constant reference to the clusters.

size_t dai::ClusterGraph::size (  )  const [inline]

Returns number of clusters.

size_t dai::ClusterGraph::findVar ( const Var n  )  const [inline]

Returns the index of variable n.

VarSet dai::ClusterGraph::Delta ( size_t  i  )  const [inline]

Returns union of clusters that contain the i 'th variable.

VarSet dai::ClusterGraph::delta ( size_t  i  )  const [inline]

Returns union of clusters that contain the i 'th (except this variable itself).

bool dai::ClusterGraph::adj ( size_t  i1,
size_t  i2 
) const [inline]

Returns true if variables with indices i1 and i2 are adjacent, i.e., both contained in the same cluster.

bool dai::ClusterGraph::isMaximal ( size_t  I  )  const [inline]

Returns true if cluster I is not contained in a larger cluster.

void dai::ClusterGraph::insert ( const VarSet cl  )  [inline]

Inserts a cluster (if it does not already exist).

ClusterGraph& dai::ClusterGraph::eraseNonMaximal (  )  [inline]

Erases all clusters that are not maximal.

ClusterGraph& dai::ClusterGraph::eraseSubsuming ( size_t  i  )  [inline]

Erases all clusters that contain the i 'th variable.

template<class EliminationChoice>
ClusterGraph dai::ClusterGraph::VarElim ( EliminationChoice  f  )  const [inline]

Performs Variable Elimination, only keeping track of the interactions that are created along the way.

Template Parameters:
EliminationChoice should support "size_t operator()( const ClusterGraph &cl, const std::set<size_t> &remainingVars )"
Parameters:
f function object which returns the next variable index to eliminate; for example, a dai::greedyVariableElimination object.
Returns:
A set of elimination "cliques".

size_t dai::ClusterGraph::eliminationCost ( size_t  i  )  const

Calculates cost of eliminating the i 'th variable.

The cost is measured as "number of added edges in the adjacency graph", where the adjacency graph has the variables as its nodes and connects nodes i1 and i2 iff i1 and i2 occur together in some common cluster.

Deprecated:
Please use dai::eliminationCost_MinFill() instead.

ClusterGraph dai::ClusterGraph::VarElim ( const std::vector< Var > &  ElimSeq  )  const

Performs Variable Elimination, only keeping track of the interactions that are created along the way.

Parameters:
ElimSeq The sequence in which to eliminate the variables
Returns:
A set of elimination "cliques"
Deprecated:
Please use dai::ClusterGraph::VarElim( sequentialVariableElimination( ElimSeq ) ) instead.

ClusterGraph dai::ClusterGraph::VarElim_MinFill (  )  const

Performs Variable Elimination using the "MinFill" heuristic.

The "MinFill" heuristic greedily minimizes the cost of eliminating a variable, measured with eliminationCost().

Returns:
A set of elimination "cliques".
Deprecated:
Please use dai::ClusterGraph::VarElim( greedyVariableElimination( eliminationCost_MinFill ) ) instead.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const ClusterGraph cl 
) [friend]

Writes a ClusterGraph to an output stream.


Member Data Documentation

Stores the neighborhood structure.

Stores the variables corresponding to the nodes.

Stores the clusters corresponding to the hyperedges.


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

Generated on Thu Feb 11 12:26:02 2010 for libDAI by  doxygen 1.5.5