opengm::FactorGraph< S, I > Class Template Reference

Interface that makes an object of type S (the template parameter) look like a (non-editable) factor graph. More...

#include <factorgraph.hxx>

Inheritance diagram for opengm::FactorGraph< S, I >:
Inheritance graph
[legend]

List of all members.

Classes

class  FactorAccessor
class  VariableAccessor

Public Types

typedef S SpecialType
typedef AccessorIterator
< VariableAccessor, true > 
ConstVariableIterator
typedef AccessorIterator
< FactorAccessor, true > 
ConstFactorIterator

Public Member Functions

size_t numberOfVariables () const
 total number of variable nodes in the factor graph
size_t numberOfVariables (const size_t) const
 number of variable nodes connected to a factor node
size_t numberOfFactors () const
 total number of factor nodes in the factor graph
size_t numberOfFactors (const size_t) const
 number of factor nodes connected to a variable node
size_t variableOfFactor (const size_t, const size_t) const
 j-th variable node connected to a factor node
size_t factorOfVariable (const size_t, const size_t) const
 j-th factor node connected to a variable node
ConstVariableIterator variablesOfFactorBegin (const size_t) const
 constant iterator to the beginning of the squence of variables connected to a factor
ConstVariableIterator variablesOfFactorEnd (const size_t) const
 constant iterator to the end of the squence of variables connected to a factor
ConstFactorIterator factorsOfVariableBegin (const size_t) const
 constant iterator to the beginning of the squence of factors connected to a variable
ConstFactorIterator factorsOfVariableEnd (const size_t) const
 constant iterator to the end of the squence of factors connected to a variable
bool variableFactorConnection (const size_t, const size_t) const
 return true if a factor is connected to a variable
bool factorVariableConnection (const size_t, const size_t) const
 return true if a variable is connected to a factor
bool variableVariableConnection (const size_t, const size_t) const
 return true if a variable is connected to a variable
bool factorFactorConnection (const size_t, const size_t) const
 return true if a factor is connected to a factor
bool isAcyclic () const
 return true if the factor graph (!) is acyclic
bool isConnected (marray::Vector< size_t > &representatives) const
 return true if the factor graph (!) is connected
bool isChain (marray::Vector< size_t > &) const
 return true if the factor graph (!) is a chain
bool isGrid (marray::Matrix< size_t > &) const
 return true if the factor graph (!) is a grid
size_t maxFactorOrder () const
 return maximum factor order
bool maxFactorOrder (const size_t maxOrder) const
 return true if the maximum factor order is less or equal to maxOrder
size_t numberOfNthOrderFactorsOfVariable (const size_t, const size_t) const
 return number of factors with order n which are connected to variable
size_t numberOfNthOrderFactorsOfVariable (const size_t, const size_t, marray::Vector< size_t > &) const
 return number of factors with order n which are connected to variable and stores the corresponding factorIDs
size_t secondVariableOfSecondOrderFactor (const size_t, const size_t) const
 return returns the id of the second variable which is connected to a given variable via a second order factor
void variableAdjacencyMatrix (marray::Matrix< bool > &) const
 outputs the factor graph as a variable adjacency matrix
void variableAdjacencyList (std::vector< std::set< IndexType > > &) const
 outputs the factor graph as variable adjacency lists
void variableAdjacencyList (std::vector< RandomAccessSet< IndexType > > &) const
 outputs the factor graph as variable adjacency lists
void factorAdjacencyList (std::vector< std::set< IndexType > > &) const
void factorAdjacencyList (std::vector< RandomAccessSet< IndexType > > &) const

Protected Member Functions

 operator S & ()
 operator S const & () const
template<class LIST >
bool shortestPath (const size_t, const size_t, LIST &, const LIST &=LIST()) const
 computes the shortest path from s to t using Dijkstra's algorithm with uniform distances
template<class LIST >
bool twoHopConnected (const size_t, const size_t, LIST &) const
 checks if variabel1 is connected to variable2 via two hops

Detailed Description

template<class S, class I>
class opengm::FactorGraph< S, I >

Interface that makes an object of type S (the template parameter) look like a (non-editable) factor graph.

Definition at line 18 of file factorgraph.hxx.


Member Typedef Documentation

template<class S, class I>
typedef AccessorIterator<FactorAccessor, true> opengm::FactorGraph< S, I >::ConstFactorIterator

Definition at line 26 of file factorgraph.hxx.

template<class S, class I>
typedef AccessorIterator<VariableAccessor, true> opengm::FactorGraph< S, I >::ConstVariableIterator

Definition at line 25 of file factorgraph.hxx.

template<class S, class I>
typedef S opengm::FactorGraph< S, I >::SpecialType

Definition at line 24 of file factorgraph.hxx.


Member Function Documentation

template<class S , class I >
void opengm::FactorGraph< S, I >::factorAdjacencyList ( std::vector< RandomAccessSet< IndexType > > &  out  )  const [inline]

Definition at line 911 of file factorgraph.hxx.

template<class S , class I >
void opengm::FactorGraph< S, I >::factorAdjacencyList ( std::vector< std::set< IndexType > > &  out  )  const [inline]

Definition at line 901 of file factorgraph.hxx.

template<class S , class I >
bool opengm::FactorGraph< S, I >::factorFactorConnection ( const size_t  factor1,
const size_t  factor2 
) const [inline]

return true if a factor is connected to a factor

Parameters:
factor1 variable index
factor2 variable index
Returns:
result

Definition at line 803 of file factorgraph.hxx.

template<class S , class I >
size_t opengm::FactorGraph< S, I >::factorOfVariable ( const size_t  variable,
const size_t  j 
) const [inline]

j-th factor node connected to a variable node

Parameters:
variable variable index
j number of the factor w.r.t. the variable
Returns:
factor index

Definition at line 198 of file factorgraph.hxx.

Here is the caller graph for this function:

template<class S , class I >
FactorGraph< S, I >::ConstFactorIterator opengm::FactorGraph< S, I >::factorsOfVariableBegin ( const size_t  variable  )  const [inline]

constant iterator to the beginning of the squence of factors connected to a variable

Parameters:
variable variable index
Returns:
iterator

Definition at line 240 of file factorgraph.hxx.

Here is the caller graph for this function:

template<class S , class I >
FactorGraph< S, I >::ConstFactorIterator opengm::FactorGraph< S, I >::factorsOfVariableEnd ( const size_t  variable  )  const [inline]

constant iterator to the end of the squence of factors connected to a variable

Parameters:
variable variable index
Returns:
iterator

Definition at line 254 of file factorgraph.hxx.

Here is the caller graph for this function:

template<class S , class I >
bool opengm::FactorGraph< S, I >::factorVariableConnection ( const size_t  factor,
const size_t  variable 
) const [inline]

return true if a variable is connected to a factor

Parameters:
factor factor index
variable variable index
Returns:
result

Definition at line 293 of file factorgraph.hxx.

template<class S , class I >
bool opengm::FactorGraph< S, I >::isAcyclic (  )  const [inline]

return true if the factor graph (!) is acyclic

Returns:
result

Definition at line 339 of file factorgraph.hxx.

Here is the call graph for this function:

template<class S , class I >
bool opengm::FactorGraph< S, I >::isChain ( marray::Vector< size_t > &  chainIDs  )  const [inline]

return true if the factor graph (!) is a chain

Parameters:
[out] chainIDs A vector representing the chain, where chain(i) contains the corresponding variable ID.
Returns:
result

Definition at line 431 of file factorgraph.hxx.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class S , class I >
bool opengm::FactorGraph< S, I >::isConnected ( marray::Vector< size_t > &  representatives  )  const [inline]

return true if the factor graph (!) is connected

Parameters:
[out] representatives A vector of variable id's where each id is a representative of a connected component.
Returns:
result

Definition at line 392 of file factorgraph.hxx.

Here is the call graph for this function:

template<class S , class I >
bool opengm::FactorGraph< S, I >::isGrid ( marray::Matrix< size_t > &  gridIDs  )  const [inline]

return true if the factor graph (!) is a grid

Parameters:
[out] gridIDs A matrix representing the grid, where grid(i,j) contains the corresponding variable ID.
Returns:
result

Definition at line 529 of file factorgraph.hxx.

Here is the call graph for this function:

template<class S , class I >
bool opengm::FactorGraph< S, I >::maxFactorOrder ( const size_t  maxOrder  )  const [inline]

return true if the maximum factor order is less or equal to maxOrder

Parameters:
maxOrder maximum allowed factor order
Returns:
result

Definition at line 729 of file factorgraph.hxx.

Here is the call graph for this function:

template<class S , class I >
size_t opengm::FactorGraph< S, I >::maxFactorOrder (  )  const [inline]

return maximum factor order

Returns:
maximum factor order

Definition at line 714 of file factorgraph.hxx.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class S , class I >
size_t opengm::FactorGraph< S, I >::numberOfFactors ( const size_t  variable  )  const [inline]

number of factor nodes connected to a variable node

Parameters:
variable variable index
Returns:
number of factor nodes

Definition at line 169 of file factorgraph.hxx.

template<class S , class I >
size_t opengm::FactorGraph< S, I >::numberOfFactors (  )  const [inline]

total number of factor nodes in the factor graph

Returns:
number of factor nodes

Reimplemented in opengm::GraphicalModel< T, OPERATOR, FUNCTION_TYPE_LIST, SPACE, EDITABLE >.

Definition at line 158 of file factorgraph.hxx.

Here is the caller graph for this function:

template<class S , class I >
size_t opengm::FactorGraph< S, I >::numberOfNthOrderFactorsOfVariable ( const size_t  variable,
const size_t  n,
marray::Vector< size_t > &  factorIDs 
) const [inline]

return number of factors with order n which are connected to variable and stores the corresponding factorIDs

Parameters:
variable variable index
n desired order of factors
[out] factorIDs factorIDs of all n'th order factors connected to a given variable
Returns:
result

Definition at line 762 of file factorgraph.hxx.

Here is the call graph for this function:

template<class S , class I >
size_t opengm::FactorGraph< S, I >::numberOfNthOrderFactorsOfVariable ( const size_t  variable,
const size_t  n 
) const [inline]

return number of factors with order n which are connected to variable

Parameters:
variable variable index
n desired order of factors
Returns:
result

Definition at line 744 of file factorgraph.hxx.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class S , class I >
size_t opengm::FactorGraph< S, I >::numberOfVariables ( const size_t  factor  )  const [inline]

number of variable nodes connected to a factor node

Parameters:
factor factor index
Returns:
number of variable nodes

Definition at line 147 of file factorgraph.hxx.

template<class S , class I >
size_t opengm::FactorGraph< S, I >::numberOfVariables (  )  const [inline]

total number of variable nodes in the factor graph

Returns:
number of variable nodes

Reimplemented in opengm::GraphicalModel< T, OPERATOR, FUNCTION_TYPE_LIST, SPACE, EDITABLE >.

Definition at line 136 of file factorgraph.hxx.

Here is the caller graph for this function:

template<class S, class I>
opengm::FactorGraph< S, I >::operator S & (  )  [inline, protected]

Definition at line 65 of file factorgraph.hxx.

template<class S, class I>
opengm::FactorGraph< S, I >::operator S const & (  )  const [inline, protected]

Definition at line 67 of file factorgraph.hxx.

template<class S , class I >
size_t opengm::FactorGraph< S, I >::secondVariableOfSecondOrderFactor ( const size_t  variable,
const size_t  factor 
) const [inline]

return returns the id of the second variable which is connected to a given variable via a second order factor

Parameters:
variable variable index
factor factor index
Returns:
result

Definition at line 783 of file factorgraph.hxx.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class S , class I >
template<class LIST >
bool opengm::FactorGraph< S, I >::shortestPath ( const size_t  s,
const size_t  t,
LIST &  path,
const LIST &  allowedVariables = LIST() 
) const [inline, protected]

computes the shortest path from s to t using Dijkstra's algorithm with uniform distances

Parameters:
s ID of the start variable
t ID of the target variable
[out] path returns computed path from s to t
allowedVariables path is only allowed to contain variables which are given here (if empty, all variables are allowed)

Definition at line 948 of file factorgraph.hxx.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class S , class I >
template<class LIST >
bool opengm::FactorGraph< S, I >::twoHopConnected ( const size_t  variable1,
const size_t  variable2,
LIST &  oneHopVariables 
) const [inline, protected]

checks if variabel1 is connected to variable2 via two hops

Parameters:
variable1 ID of the first variable
variable2 ID of the second variable
[out] oneHopVariables a List of all possible one hop variables in the two hop path from variable1 to variable2

Definition at line 1077 of file factorgraph.hxx.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class S , class I >
void opengm::FactorGraph< S, I >::variableAdjacencyList ( std::vector< RandomAccessSet< IndexType > > &  out  )  const [inline]

outputs the factor graph as variable adjacency lists

Parameters:
out variable adjacency lists (as a vector of RandomAccessSets)

Definition at line 855 of file factorgraph.hxx.

template<class S , class I >
void opengm::FactorGraph< S, I >::variableAdjacencyList ( std::vector< std::set< IndexType > > &  out  )  const [inline]

outputs the factor graph as variable adjacency lists

Parameters:
out variable adjacency lists (as a vector of sets)

Definition at line 867 of file factorgraph.hxx.

template<class S , class I >
void opengm::FactorGraph< S, I >::variableAdjacencyMatrix ( marray::Matrix< bool > &  out  )  const [inline]

outputs the factor graph as a variable adjacency matrix

Parameters:
out matrix

Definition at line 833 of file factorgraph.hxx.

template<class S , class I >
bool opengm::FactorGraph< S, I >::variableFactorConnection ( const size_t  variable,
const size_t  factor 
) const [inline]

return true if a factor is connected to a variable

Parameters:
variable variable index
factor factor index
Returns:
result

Definition at line 269 of file factorgraph.hxx.

Here is the caller graph for this function:

template<class S , class I >
size_t opengm::FactorGraph< S, I >::variableOfFactor ( const size_t  factor,
const size_t  j 
) const [inline]

j-th variable node connected to a factor node

Parameters:
factor factor index
j number of the variable w.r.t. the factor
Returns:
variable index

Definition at line 183 of file factorgraph.hxx.

Here is the caller graph for this function:

template<class S , class I >
FactorGraph< S, I >::ConstVariableIterator opengm::FactorGraph< S, I >::variablesOfFactorBegin ( const size_t  factor  )  const [inline]

constant iterator to the beginning of the squence of variables connected to a factor

Parameters:
factor factor index
Returns:
iterator

Definition at line 212 of file factorgraph.hxx.

Here is the caller graph for this function:

template<class S , class I >
FactorGraph< S, I >::ConstVariableIterator opengm::FactorGraph< S, I >::variablesOfFactorEnd ( const size_t  factor  )  const [inline]

constant iterator to the end of the squence of variables connected to a factor

Parameters:
factor factor index
Returns:
iterator

Definition at line 226 of file factorgraph.hxx.

Here is the caller graph for this function:

template<class S , class I >
bool opengm::FactorGraph< S, I >::variableVariableConnection ( const size_t  variable1,
const size_t  variable2 
) const [inline]

return true if a variable is connected to a variable

Parameters:
variable1 variable index
variable2 variable index
Returns:
result

Definition at line 310 of file factorgraph.hxx.

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Jun 17 16:31:11 2013 for OpenGM by  doxygen 1.6.3