Direct Graphical Models  v.1.5.3
DirectGraphicalModels::CGraphWeiss Class Reference

Pairwise graph class. More...

#include <GraphWeiss.h>

Inheritance diagram for DirectGraphicalModels::CGraphWeiss:
Collaboration diagram for DirectGraphicalModels::CGraphWeiss:

Classes

struct  Edge
 Edge structure More...
 
struct  Node
 Node structure More...
 

Public Types

using vec_pEdge_t = std::vector< Edge * >
 
using vec_pNode_t = std::vector< Node * >
 

Public Member Functions

 CGraphWeiss (byte nStates)
 Constructor. More...
 
virtual ~CGraphWeiss (void)
 
virtual void reset (void)
 Resets the graph. More...
 
virtual size_t addNode (void)
 Adds an additional node. More...
 
virtual size_t addNode (const Mat &pot)
 Adds an additional node with specified potentional. More...
 
virtual void setNode (size_t node, const Mat &pot)
 Sets or changes the potential of node. More...
 
virtual void getNode (size_t node, Mat &pot) const
 Returns the node potential. More...
 
virtual void getChildNodes (size_t node, vec_size_t &vNodes) const
 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
 Returns the set of IDs of the parent nodes of the argument node. More...
 
virtual void addEdge (size_t srcNode, size_t dstNode)
 Adds an additional directed edge. More...
 
virtual void addEdge (size_t srcNode, size_t dstNode, const Mat &pot)
 Adds an additional directed edge with specified potentional. More...
 
virtual void setEdge (size_t srcNode, size_t dstNode, const Mat &pot)
 Sets or changes the potentional of directed edge. More...
 
virtual void getEdge (size_t srcNode, size_t dstNode, Mat &pot) const
 Returns the edge potential. More...
 
virtual void addArk (size_t Node1, size_t Node2)
 
virtual void addArk (size_t Node1, size_t Node2, const Mat &pot)
 
virtual void setArk (size_t Node1, size_t Node2, const Mat &pot)
 
virtual size_t getNumNodes (void) const
 Returns the number of nodes in the graph. More...
 
- Public Member Functions inherited from DirectGraphicalModels::IGraph
 IGraph (byte nStates)
 Constructor. More...
 
virtual ~IGraph (void)
 
virtual void setEdgeGroup (size_t srcNode, size_t dstNode, byte group)=0
 Assigns a directed edge (srcNode) –> (dstNode) to the group group. More...
 
virtual byte getEdgeGroup (size_t srcNode, size_t dstNode) const =0
 Returns the group of the edge. More...
 
virtual void removeEdge (size_t srcNode, size_t dstNode)=0
 Removes the specified edge. More...
 
virtual bool isEdgeExists (size_t srcNode, size_t dstNode) const =0
 Checks whether the edge exists. More...
 
virtual bool isEdgeArc (size_t srcNode, size_t dstNode) const =0
 Checks whether the edge is a part of an arc. More...
 
virtual void addArc (size_t Node1, size_t Node2)=0
 Adds an additional udirected edge (arc) More...
 
virtual void addArc (size_t Node1, size_t Node2, const Mat &pot)=0
 Adds an additional udirected edge (arc) with specified potentional. More...
 
virtual void setArc (size_t Node1, size_t Node2, const Mat &pot)=0
 Sets or changes the potentional of udirected edge (arc) More...
 
virtual void setArcGroup (size_t Node1, size_t Node2, byte group)=0
 Assigns an undirected edge (arc) (Node1) – (Node2) to the group group. More...
 
virtual void removeArc (size_t Node1, size_t Node2)=0
 Removes the specified arc. More...
 
virtual bool isArcExists (size_t Node1, size_t Node2) const =0
 Checks whether the arc exists. More...
 
virtual size_t getNumEdges (void) const =0
 Returns the number of edges in the graph. More...
 

Friends

class CInferLBP
 
class CInferViterbi
 
class CDecodeExact
 
class CDecodeTRW
 

Additional Inherited Members

- Protected Attributes inherited from DirectGraphicalModels::IGraph
byte m_nStates
 The number of states (classes) More...
 

Detailed Description

Pairwise graph class.

Implementation is based on M. A. Weiss recommendations

Warning
This class is added for academic reasons. Do not use with Inference / Decoding classes
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 18 of file GraphWeiss.h.

Member Typedef Documentation

◆ vec_pEdge_t

Definition at line 56 of file GraphWeiss.h.

◆ vec_pNode_t

Definition at line 78 of file GraphWeiss.h.

Constructor & Destructor Documentation

◆ CGraphWeiss()

DirectGraphicalModels::CGraphWeiss::CGraphWeiss ( byte  nStates)

Constructor.

Parameters
nStatesthe number of States (classes)

Definition at line 7 of file GraphWeiss.cpp.

◆ ~CGraphWeiss()

DirectGraphicalModels::CGraphWeiss::~CGraphWeiss ( void  )
virtual

Definition at line 11 of file GraphWeiss.cpp.

Member Function Documentation

◆ addArk() [1/2]

void DirectGraphicalModels::CGraphWeiss::addArk ( size_t  Node1,
size_t  Node2 
)
virtual

Definition at line 166 of file GraphWeiss.cpp.

Here is the call graph for this function:

◆ addArk() [2/2]

void DirectGraphicalModels::CGraphWeiss::addArk ( size_t  Node1,
size_t  Node2,
const Mat &  pot 
)
virtual

Definition at line 173 of file GraphWeiss.cpp.

Here is the call graph for this function:

◆ addEdge() [1/2]

void DirectGraphicalModels::CGraphWeiss::addEdge ( size_t  srcNode,
size_t  dstNode 
)
virtual

Adds an additional directed edge.

Parameters
srcNodeindex of the source node
dstNodeindex of the destination node

Implements DirectGraphicalModels::IGraph.

Definition at line 88 of file GraphWeiss.cpp.

Here is the caller graph for this function:

◆ addEdge() [2/2]

void DirectGraphicalModels::CGraphWeiss::addEdge ( size_t  srcNode,
size_t  dstNode,
const Mat &  pot 
)
virtual

Adds an additional directed edge with specified potentional.

Parameters
srcNodeindex of the source node
dstNodeindex of the destination node
potedge potential matrix: Mat(size: nStates x nStates; type: CV_32FC1)

Implements DirectGraphicalModels::IGraph.

Definition at line 102 of file GraphWeiss.cpp.

◆ addNode() [1/2]

size_t DirectGraphicalModels::CGraphWeiss::addNode ( void  )
virtual

Adds an additional node.

Returns
the node's ID

Implements DirectGraphicalModels::IGraph.

Definition at line 29 of file GraphWeiss.cpp.

◆ addNode() [2/2]

size_t DirectGraphicalModels::CGraphWeiss::addNode ( const Mat &  pot)
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

Implements DirectGraphicalModels::IGraph.

Definition at line 38 of file GraphWeiss.cpp.

◆ getChildNodes()

void DirectGraphicalModels::CGraphWeiss::getChildNodes ( size_t  node,
vec_size_t &  vNodes 
) const
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

Implements DirectGraphicalModels::IGraph.

Definition at line 68 of file GraphWeiss.cpp.

◆ getEdge()

void DirectGraphicalModels::CGraphWeiss::getEdge ( size_t  srcNode,
size_t  dstNode,
Mat &  pot 
) const
virtual

Returns the edge potential.

Parameters
[in]srcNodeindex of the source node
[in]dstNodeindex of the destination node
[out]potedge potential matrix: Mat(size: nStates x nStates; type: CV_32FC1) if exists, empty Mat otherwise

Implements DirectGraphicalModels::IGraph.

Definition at line 145 of file GraphWeiss.cpp.

◆ getNode()

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

Returns the node potential.

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

Implements DirectGraphicalModels::IGraph.

Definition at line 58 of file GraphWeiss.cpp.

◆ getNumNodes()

virtual size_t DirectGraphicalModels::CGraphWeiss::getNumNodes ( void  ) const
inlinevirtual

Returns the number of nodes in the graph.

Returns
number of nodes

Implements DirectGraphicalModels::IGraph.

Definition at line 107 of file GraphWeiss.h.

◆ getParentNodes()

void DirectGraphicalModels::CGraphWeiss::getParentNodes ( size_t  node,
vec_size_t &  vNodes 
) const
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

Implements DirectGraphicalModels::IGraph.

Definition at line 78 of file GraphWeiss.cpp.

◆ reset()

void DirectGraphicalModels::CGraphWeiss::reset ( void  )
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.

Implements DirectGraphicalModels::IGraph.

Definition at line 19 of file GraphWeiss.cpp.

◆ setArk()

void DirectGraphicalModels::CGraphWeiss::setArk ( size_t  Node1,
size_t  Node2,
const Mat &  pot 
)
virtual

Definition at line 191 of file GraphWeiss.cpp.

Here is the call graph for this function:

◆ setEdge()

void DirectGraphicalModels::CGraphWeiss::setEdge ( size_t  srcNode,
size_t  dstNode,
const Mat &  pot 
)
virtual

Sets or changes the potentional of directed edge.

Parameters
srcNodeindex of the source node
dstNodeindex of the destination node
potedge potential matrix: Mat(size: nStates x nStates; type: CV_32FC1)

Implements DirectGraphicalModels::IGraph.

Definition at line 124 of file GraphWeiss.cpp.

Here is the caller graph for this function:

◆ setNode()

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

Sets or changes the potential of node.

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

Implements DirectGraphicalModels::IGraph.

Definition at line 48 of file GraphWeiss.cpp.

Friends And Related Function Documentation

◆ CDecodeExact

friend class CDecodeExact
friend

Definition at line 23 of file GraphWeiss.h.

◆ CDecodeTRW

friend class CDecodeTRW
friend

Definition at line 24 of file GraphWeiss.h.

◆ CInferLBP

friend class CInferLBP
friend

Definition at line 20 of file GraphWeiss.h.

◆ CInferViterbi

friend class CInferViterbi
friend

Definition at line 21 of file GraphWeiss.h.


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