Interface that makes an object of type S (the template parameter) look like a (non-editable) factor graph. More...
#include <factorgraph.hxx>
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 |
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.
typedef AccessorIterator<FactorAccessor, true> opengm::FactorGraph< S, I >::ConstFactorIterator |
Definition at line 26 of file factorgraph.hxx.
typedef AccessorIterator<VariableAccessor, true> opengm::FactorGraph< S, I >::ConstVariableIterator |
Definition at line 25 of file factorgraph.hxx.
typedef S opengm::FactorGraph< S, I >::SpecialType |
Definition at line 24 of file factorgraph.hxx.
void opengm::FactorGraph< S, I >::factorAdjacencyList | ( | std::vector< RandomAccessSet< IndexType > > & | out | ) | const [inline] |
Definition at line 911 of file factorgraph.hxx.
void opengm::FactorGraph< S, I >::factorAdjacencyList | ( | std::vector< std::set< IndexType > > & | out | ) | const [inline] |
Definition at line 901 of file factorgraph.hxx.
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
factor1 | variable index | |
factor2 | variable index |
Definition at line 803 of file factorgraph.hxx.
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
variable | variable index | |
j | number of the factor w.r.t. the variable |
Definition at line 198 of file factorgraph.hxx.
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
variable | variable index |
Definition at line 240 of file factorgraph.hxx.
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
variable | variable index |
Definition at line 254 of file factorgraph.hxx.
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
factor | factor index | |
variable | variable index |
Definition at line 293 of file factorgraph.hxx.
bool opengm::FactorGraph< S, I >::isAcyclic | ( | ) | const [inline] |
return true if the factor graph (!) is acyclic
Definition at line 339 of file factorgraph.hxx.
bool opengm::FactorGraph< S, I >::isChain | ( | marray::Vector< size_t > & | chainIDs | ) | const [inline] |
return true if the factor graph (!) is a chain
[out] | chainIDs | A vector representing the chain, where chain(i) contains the corresponding variable ID. |
Definition at line 431 of file factorgraph.hxx.
bool opengm::FactorGraph< S, I >::isConnected | ( | marray::Vector< size_t > & | representatives | ) | const [inline] |
return true if the factor graph (!) is connected
[out] | representatives | A vector of variable id's where each id is a representative of a connected component. |
Definition at line 392 of file factorgraph.hxx.
bool opengm::FactorGraph< S, I >::isGrid | ( | marray::Matrix< size_t > & | gridIDs | ) | const [inline] |
return true if the factor graph (!) is a grid
[out] | gridIDs | A matrix representing the grid, where grid(i,j) contains the corresponding variable ID. |
Definition at line 529 of file factorgraph.hxx.
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
maxOrder | maximum allowed factor order |
Definition at line 729 of file factorgraph.hxx.
size_t opengm::FactorGraph< S, I >::maxFactorOrder | ( | ) | const [inline] |
return maximum factor order
Definition at line 714 of file factorgraph.hxx.
size_t opengm::FactorGraph< S, I >::numberOfFactors | ( | const size_t | variable | ) | const [inline] |
number of factor nodes connected to a variable node
variable | variable index |
Definition at line 169 of file factorgraph.hxx.
size_t opengm::FactorGraph< S, I >::numberOfFactors | ( | ) | const [inline] |
total number of factor nodes in the factor graph
Reimplemented in opengm::GraphicalModel< T, OPERATOR, FUNCTION_TYPE_LIST, SPACE, EDITABLE >.
Definition at line 158 of file factorgraph.hxx.
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
variable | variable index | |
n | desired order of factors | |
[out] | factorIDs | factorIDs of all n'th order factors connected to a given variable |
Definition at line 762 of file factorgraph.hxx.
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
variable | variable index | |
n | desired order of factors |
Definition at line 744 of file factorgraph.hxx.
size_t opengm::FactorGraph< S, I >::numberOfVariables | ( | const size_t | factor | ) | const [inline] |
number of variable nodes connected to a factor node
factor | factor index |
Definition at line 147 of file factorgraph.hxx.
size_t opengm::FactorGraph< S, I >::numberOfVariables | ( | ) | const [inline] |
total number of variable nodes in the factor graph
Reimplemented in opengm::GraphicalModel< T, OPERATOR, FUNCTION_TYPE_LIST, SPACE, EDITABLE >.
Definition at line 136 of file factorgraph.hxx.
opengm::FactorGraph< S, I >::operator S & | ( | ) | [inline, protected] |
Definition at line 65 of file factorgraph.hxx.
opengm::FactorGraph< S, I >::operator S const & | ( | ) | const [inline, protected] |
Definition at line 67 of file factorgraph.hxx.
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
variable | variable index | |
factor | factor index |
Definition at line 783 of file factorgraph.hxx.
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
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.
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
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.
void opengm::FactorGraph< S, I >::variableAdjacencyList | ( | std::vector< RandomAccessSet< IndexType > > & | out | ) | const [inline] |
outputs the factor graph as variable adjacency lists
out | variable adjacency lists (as a vector of RandomAccessSets) |
Definition at line 855 of file factorgraph.hxx.
void opengm::FactorGraph< S, I >::variableAdjacencyList | ( | std::vector< std::set< IndexType > > & | out | ) | const [inline] |
outputs the factor graph as variable adjacency lists
out | variable adjacency lists (as a vector of sets) |
Definition at line 867 of file factorgraph.hxx.
void opengm::FactorGraph< S, I >::variableAdjacencyMatrix | ( | marray::Matrix< bool > & | out | ) | const [inline] |
outputs the factor graph as a variable adjacency matrix
out | matrix |
Definition at line 833 of file factorgraph.hxx.
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
variable | variable index | |
factor | factor index |
Definition at line 269 of file factorgraph.hxx.
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
factor | factor index | |
j | number of the variable w.r.t. the factor |
Definition at line 183 of file factorgraph.hxx.
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
factor | factor index |
Definition at line 212 of file factorgraph.hxx.
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
factor | factor index |
Definition at line 226 of file factorgraph.hxx.
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
variable1 | variable index | |
variable2 | variable index |
Definition at line 310 of file factorgraph.hxx.