Direct Graphical Models  v.1.7.0
DirectGraphicalModels::CGraph Class Referenceabstract

Interface class for graphical models. More...

#include <Graph.h>

Inheritance diagram for DirectGraphicalModels::CGraph:

Public Member Functions

 CGraph (byte nStates)
 Constructor. More...
 
 CGraph (const CGraph &)=delete
 
virtual ~CGraph (void)=default
 
const CGraphoperator= (const CGraph &)=delete
 
virtual void reset (void)=0
 Resets the graph. More...
 
virtual size_t addNode (const Mat &pot=EmptyMat)=0
 Adds an additional node (with specified potentional) More...
 
virtual void addNodes (const Mat &pots)
 Adds the graph nodes with potentials. More...
 
virtual void setNode (size_t node, const Mat &pot)=0
 Sets or changes the potential of node. More...
 
virtual void setNodes (size_t start_node, const Mat &pots)
 Fills the graph nodes with new potentials. More...
 
virtual void getNode (size_t node, Mat &pot) const =0
 Returns the node potential. More...
 
virtual void getNodes (size_t start_node, size_t num_nodes, Mat &pots) const
 Returns the node potentials. More...
 
virtual void getChildNodes (size_t node, vec_size_t &vNodes) const =0
 Returns the set of IDs of the child nodes of the argument node. More...
 
virtual void getParentNodes (size_t node, vec_size_t &vNodes) const =0
 Returns the set of IDs of the parent nodes of the argument node. More...
 
virtual size_t getNumNodes (void) const =0
 Returns the number of nodes in the graph. More...
 
virtual size_t getNumEdges (void) const =0
 Returns the number of edges in the graph. More...
 
byte getNumStates (void) const
 Returns number of states (classes) More...
 

Private Attributes

byte m_nStates
 The number of states (classes) More...
 

Detailed Description

Interface class for graphical models.

Author
Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de

Definition at line 14 of file Graph.h.

Constructor & Destructor Documentation

◆ CGraph() [1/2]

DirectGraphicalModels::CGraph::CGraph ( byte  nStates)
inline

Constructor.

Parameters
nStatesthe number of States (classes)

Definition at line 21 of file Graph.h.

◆ CGraph() [2/2]

DirectGraphicalModels::CGraph::CGraph ( const CGraph )
delete

◆ ~CGraph()

virtual DirectGraphicalModels::CGraph::~CGraph ( void  )
virtualdefault

Member Function Documentation

◆ addNode()

virtual size_t DirectGraphicalModels::CGraph::addNode ( const Mat &  pot = EmptyMat)
pure virtual

Adds an additional node (with specified potentional)

Parameters
potnode potential vector: Mat(size: nStates x 1; type: CV_32FC1)
Returns
the node's ID

Implemented in DirectGraphicalModels::CGraphWeiss, DirectGraphicalModels::CGraphPairwise, and DirectGraphicalModels::CGraphDense.

Here is the caller graph for this function:

◆ addNodes()

void DirectGraphicalModels::CGraph::addNodes ( const Mat &  pots)
virtual

Adds the graph nodes with potentials.

Parameters
potsA block of potentials: Mat(size: nNodes x nStates; type: CV_32FC1)

Reimplemented in DirectGraphicalModels::CGraphDense.

Definition at line 6 of file Graph.cpp.

Here is the call graph for this function:

◆ getChildNodes()

virtual void DirectGraphicalModels::CGraph::getChildNodes ( size_t  node,
vec_size_t &  vNodes 
) const
pure virtual

Returns the set of IDs of the child nodes of the argument node.

Parameters
[in]nodenode index
[out]vNodesvector with the child node's ID

Implemented in DirectGraphicalModels::CGraphWeiss, DirectGraphicalModels::CGraphPairwise, and DirectGraphicalModels::CGraphDense.

Here is the caller graph for this function:

◆ getNode()

virtual void DirectGraphicalModels::CGraph::getNode ( size_t  node,
Mat &  pot 
) const
pure virtual

Returns the node potential.

Parameters
[in]nodenode index
[out]potnode potential vector: Mat(size: nStates x 1; type: CV_32FC1)

Implemented in DirectGraphicalModels::CGraphWeiss, DirectGraphicalModels::CGraphPairwise, and DirectGraphicalModels::CGraphDense.

Here is the caller graph for this function:

◆ getNodes()

void DirectGraphicalModels::CGraph::getNodes ( size_t  start_node,
size_t  num_nodes,
Mat &  pots 
) const
virtual

Returns the node potentials.

This function supports PPL

Parameters
[in]start_nodeThe index of the node, starting from which the potentials should be got
[in]num_nodesThe number of nodes potentials to acquire. 0 means - read nodes from start_node till the last one.
[out]potsA block of potentials: Mat(size: num_nodes x nStates; type: CV_32FC1)

Reimplemented in DirectGraphicalModels::CGraphDense.

Definition at line 30 of file Graph.cpp.

Here is the call graph for this function:

◆ getNumEdges()

virtual size_t DirectGraphicalModels::CGraph::getNumEdges ( void  ) const
pure virtual

Returns the number of edges in the graph.

Returns
number of edges

Implemented in DirectGraphicalModels::CGraphWeiss, DirectGraphicalModels::CGraphPairwise, and DirectGraphicalModels::CGraphDense.

◆ getNumNodes()

virtual size_t DirectGraphicalModels::CGraph::getNumNodes ( void  ) const
pure virtual

Returns the number of nodes in the graph.

Returns
number of nodes

Implemented in DirectGraphicalModels::CGraphWeiss, DirectGraphicalModels::CGraphPairwise, and DirectGraphicalModels::CGraphDense.

Here is the caller graph for this function:

◆ getNumStates()

byte DirectGraphicalModels::CGraph::getNumStates ( void  ) const
inline

Returns number of states (classes)

Returns
Number of states (features)

Definition at line 99 of file Graph.h.

Here is the caller graph for this function:

◆ getParentNodes()

virtual void DirectGraphicalModels::CGraph::getParentNodes ( size_t  node,
vec_size_t &  vNodes 
) const
pure virtual

Returns the set of IDs of the parent nodes of the argument node.

Parameters
[in]nodenode index
[out]vNodesvector with the parent node's ID

Implemented in DirectGraphicalModels::CGraphWeiss, DirectGraphicalModels::CGraphPairwise, and DirectGraphicalModels::CGraphDense.

Here is the caller graph for this function:

◆ operator=()

const CGraph& DirectGraphicalModels::CGraph::operator= ( const CGraph )
delete

◆ reset()

virtual void DirectGraphicalModels::CGraph::reset ( void  )
pure virtual

Resets the graph.

This function allows to re-use the graph or update node potential, while preserving the graph structure. It deletes all the nodes and edges and sets node index to zero.

Implemented in DirectGraphicalModels::CGraphWeiss, DirectGraphicalModels::CGraphPairwise, and DirectGraphicalModels::CGraphDense.

Here is the caller graph for this function:

◆ setNode()

virtual void DirectGraphicalModels::CGraph::setNode ( size_t  node,
const Mat &  pot 
)
pure virtual

Sets or changes the potential of node.

Parameters
nodenode index
potnode potential vector: Mat(size: nStates x 1; type: CV_32FC1)

Implemented in DirectGraphicalModels::CGraphWeiss, DirectGraphicalModels::CGraphPairwise, and DirectGraphicalModels::CGraphDense.

Here is the caller graph for this function:

◆ setNodes()

void DirectGraphicalModels::CGraph::setNodes ( size_t  start_node,
const Mat &  pots 
)
virtual

Fills the graph nodes with new potentials.

This function supports PPL

Parameters
start_nodeThe index of the node, starting from which the potentials should be set
potsA block of potentials: Mat(size: nNodes x nStates; type: CV_32FC1)

Reimplemented in DirectGraphicalModels::CGraphDense.

Definition at line 11 of file Graph.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_nStates

byte DirectGraphicalModels::CGraph::m_nStates
private

The number of states (classes)

Definition at line 103 of file Graph.h.


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