Direct Graphical Models  v.1.5.3
DirectGraphicalModels::IGraph Class Referenceabstract

Interface class for graphical models. More...

#include <IGraph.h>

Inheritance diagram for DirectGraphicalModels::IGraph:

Public Member Functions

 IGraph (byte nStates)
 Constructor. More...
 
virtual ~IGraph (void)
 
virtual void reset (void)=0
 Resets the graph. More...
 
virtual size_t addNode (void)=0
 Adds an additional node. More...
 
virtual size_t addNode (const Mat &pot)=0
 Adds an additional node with specified potentional. More...
 
virtual void setNode (size_t node, const Mat &pot)=0
 Sets or changes the potential of node. More...
 
virtual void getNode (size_t node, Mat &pot) const =0
 Returns the node potential. 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 void addEdge (size_t srcNode, size_t dstNode)=0
 Adds an additional directed edge. More...
 
virtual void addEdge (size_t srcNode, size_t dstNode, const Mat &pot)=0
 Adds an additional directed edge with specified potentional. More...
 
virtual void setEdge (size_t srcNode, size_t dstNode, const Mat &pot)=0
 Sets or changes the potentional of directed edge. More...
 
virtual void getEdge (size_t srcNode, size_t dstNode, Mat &pot) const =0
 Returns the edge potential. More...
 
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 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...
 

Protected 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 IGraph.h.

Constructor & Destructor Documentation

◆ IGraph()

DirectGraphicalModels::IGraph::IGraph ( byte  nStates)
inline

Constructor.

Parameters
nStatesthe number of States (classes)

Definition at line 21 of file IGraph.h.

◆ ~IGraph()

virtual DirectGraphicalModels::IGraph::~IGraph ( void  )
inlinevirtual

Definition at line 22 of file IGraph.h.

Member Function Documentation

◆ addArc() [1/2]

virtual void DirectGraphicalModels::IGraph::addArc ( size_t  Node1,
size_t  Node2 
)
pure virtual

Adds an additional udirected edge (arc)

The arc is emulated by adding two directed edges

Parameters
Node1index of the first node
Node2index of the second node

Implemented in DirectGraphicalModels::CGraph, and DirectGraphicalModels::CGraphBoost.

◆ addArc() [2/2]

virtual void DirectGraphicalModels::IGraph::addArc ( size_t  Node1,
size_t  Node2,
const Mat &  pot 
)
pure virtual

Adds an additional udirected edge (arc) with specified potentional.

The arc is emulated by adding two directed edges. For sake of consistency the pot matrix here is squarerooted:

addEdge(Node1, Node2, sqrt(pot));
addEdge(Node2, Node1, sqrt(pot));
Parameters
Node1index of the first node
Node2index of the second node
potedge potential matrix: Mat(size: nStates x nStates; type: CV_32FC1)

Implemented in DirectGraphicalModels::CGraph, and DirectGraphicalModels::CGraphBoost.

◆ addEdge() [1/2]

virtual void DirectGraphicalModels::IGraph::addEdge ( size_t  srcNode,
size_t  dstNode 
)
pure virtual

Adds an additional directed edge.

Parameters
srcNodeindex of the source node
dstNodeindex of the destination node

Implemented in DirectGraphicalModels::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

◆ addEdge() [2/2]

virtual void DirectGraphicalModels::IGraph::addEdge ( size_t  srcNode,
size_t  dstNode,
const Mat &  pot 
)
pure 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)

Implemented in DirectGraphicalModels::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

◆ addNode() [1/2]

virtual size_t DirectGraphicalModels::IGraph::addNode ( void  )
pure virtual

Adds an additional node.

Returns
the node's ID

Implemented in DirectGraphicalModels::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

◆ addNode() [2/2]

virtual size_t DirectGraphicalModels::IGraph::addNode ( const Mat &  pot)
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::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

◆ getChildNodes()

virtual void DirectGraphicalModels::IGraph::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::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

Here is the caller graph for this function:

◆ getEdge()

virtual void DirectGraphicalModels::IGraph::getEdge ( size_t  srcNode,
size_t  dstNode,
Mat &  pot 
) const
pure 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

Implemented in DirectGraphicalModels::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

◆ getEdgeGroup()

virtual byte DirectGraphicalModels::IGraph::getEdgeGroup ( size_t  srcNode,
size_t  dstNode 
) const
pure virtual

Returns the group of the edge.

Parameters
srcNodeindex of the source node
dstNodeindex of the destination node
Returns
The edge group ID

Implemented in DirectGraphicalModels::CGraph.

Here is the caller graph for this function:

◆ getNode()

virtual void DirectGraphicalModels::IGraph::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::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

◆ getNumEdges()

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

Returns the number of edges in the graph.

Returns
number of edges

Implemented in DirectGraphicalModels::CGraph.

◆ getNumNodes()

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

Returns the number of nodes in the graph.

Returns
number of nodes

Implemented in DirectGraphicalModels::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

Here is the caller graph for this function:

◆ getParentNodes()

virtual void DirectGraphicalModels::IGraph::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::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

◆ isArcExists()

virtual bool DirectGraphicalModels::IGraph::isArcExists ( size_t  Node1,
size_t  Node2 
) const
pure virtual

Checks whether the arc exists.

Parameters
Node1index of the first node
Node2index of the second node
Return values
trueif the arc exists
falseotherwise

Implemented in DirectGraphicalModels::CGraph.

◆ isEdgeArc()

virtual bool DirectGraphicalModels::IGraph::isEdgeArc ( size_t  srcNode,
size_t  dstNode 
) const
pure virtual

Checks whether the edge is a part of an arc.

In contrast to the isArcExists() function, this function does not checks whether the input edge exists, and thus faster

Parameters
srcNodeindex of the source node
dstNodeindex of the destination node
Return values
trueif the edge is a part of an arc
falseotherwise

Implemented in DirectGraphicalModels::CGraph.

Here is the caller graph for this function:

◆ isEdgeExists()

virtual bool DirectGraphicalModels::IGraph::isEdgeExists ( size_t  srcNode,
size_t  dstNode 
) const
pure virtual

Checks whether the edge exists.

Parameters
srcNodeindex of the source node
dstNodeindex of the destination node
Return values
trueif the edge exists
falseotherwise

Implemented in DirectGraphicalModels::CGraph.

◆ removeArc()

virtual void DirectGraphicalModels::IGraph::removeArc ( size_t  Node1,
size_t  Node2 
)
pure virtual

Removes the specified arc.

Parameters
Node1index of the first node
Node2index of the second node

Implemented in DirectGraphicalModels::CGraph.

◆ removeEdge()

virtual void DirectGraphicalModels::IGraph::removeEdge ( size_t  srcNode,
size_t  dstNode 
)
pure virtual

Removes the specified edge.

Parameters
srcNodeindex of the source node
dstNodeindex of the destination node

Implemented in DirectGraphicalModels::CGraph.

◆ reset()

virtual void DirectGraphicalModels::IGraph::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::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

◆ setArc()

virtual void DirectGraphicalModels::IGraph::setArc ( size_t  Node1,
size_t  Node2,
const Mat &  pot 
)
pure virtual

Sets or changes the potentional of udirected edge (arc)

The arc is emulated by adding two directed edges. For sake of consistency the pot matrix here is squarerooted:

addEdge(Node1, Node2, sqrt(pot));
addEdge(Node2, Node1, sqrt(pot));
Parameters
Node1index of the first node
Node2index of the second node
potedge potential matrix: Mat(size: nStates x nStates; type: CV_32FC1)

Implemented in DirectGraphicalModels::CGraph, and DirectGraphicalModels::CGraphBoost.

◆ setArcGroup()

virtual void DirectGraphicalModels::IGraph::setArcGroup ( size_t  Node1,
size_t  Node2,
byte  group 
)
pure virtual

Assigns an undirected edge (arc) (Node1) – (Node2) to the group group.

Parameters
Node1index of the source node
Node2index of the destination node
groupThe edge group ID

Implemented in DirectGraphicalModels::CGraph.

◆ setEdge()

virtual void DirectGraphicalModels::IGraph::setEdge ( size_t  srcNode,
size_t  dstNode,
const Mat &  pot 
)
pure 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)

Implemented in DirectGraphicalModels::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

◆ setEdgeGroup()

virtual void DirectGraphicalModels::IGraph::setEdgeGroup ( size_t  srcNode,
size_t  dstNode,
byte  group 
)
pure virtual

Assigns a directed edge (srcNode) –> (dstNode) to the group group.

Parameters
srcNodeindex of the source node
dstNodeindex of the destination node
groupThe edge group ID

Implemented in DirectGraphicalModels::CGraph.

◆ setNode()

virtual void DirectGraphicalModels::IGraph::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::CGraph, DirectGraphicalModels::CGraphWeiss, and DirectGraphicalModels::CGraphBoost.

Member Data Documentation

◆ m_nStates

byte DirectGraphicalModels::IGraph::m_nStates
protected

The number of states (classes)

Definition at line 194 of file IGraph.h.


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