5 #include "IGraphPairwise.h" 66 Node(
size_t _id,
const Mat& p = EmptyMat) :
id(_id),
Pot(p.empty() ? Mat() : p.clone()) {}
86 DllExport
void reset(
void)
override;
87 DllExport
size_t addNode(
const Mat &pot = EmptyMat)
override;
88 DllExport
void setNode(
size_t node,
const Mat &pot)
override;
89 DllExport
void getNode(
size_t node, Mat &pot)
const override;
90 DllExport
void getChildNodes(
size_t node, vec_size_t &vNodes)
const override;
91 DllExport
void getParentNodes(
size_t node, vec_size_t &vNodes)
const override;
95 DllExport
void addEdge (
size_t srcNode,
size_t dstNode, byte group,
const Mat &pot)
override;
96 DllExport
void setEdge (
size_t srcNode,
size_t dstNode,
const Mat &pot)
override;
97 DllExport
void setEdges (std::optional<byte> group,
const Mat& pot)
override;
98 DllExport
void getEdge (
size_t srcNode,
size_t dstNode, Mat &pot)
const override;
99 DllExport
void setEdgeGroup(
size_t srcNode,
size_t dstNode, byte group)
override;
100 DllExport byte
getEdgeGroup(
size_t srcNode,
size_t dstNode)
const override;
101 DllExport
void removeEdge (
size_t srcNode,
size_t dstNode)
override;
102 DllExport
bool isEdgeExists(
size_t srcNode,
size_t dstNode)
const override;
112 DllExport
Edge*
findEdge(
size_t srcNode,
size_t dstNode)
const;
float * msg
Message (for the loopyBP algorithm: class CDecodeLPB): Mat(size: nStates x 1; type: CV_32FC1) ...
Edge(Node *n1, Node *n2, byte group=0, const Mat &p=EmptyMat)
size_t getNumEdges(void) const override
Returns the number of edges in the graph.
size_t addNode(const Mat &pot=EmptyMat) override
Adds an additional node (with specified potentional)
void getEdge(size_t srcNode, size_t dstNode, Mat &pot) const override
Returns the edge potential.
void getNode(size_t node, Mat &pot) const override
Returns the node potential.
Mat Pot
Node potentials: Mat(size: nStates x 1; type: CV_32FC1)
void getChildNodes(size_t node, vec_size_t &vNodes) const override
Returns the set of IDs of the child nodes of the argument node.
vec_pEdge_t to
Child vertices (and potentials)
void setNode(size_t node, const Mat &pot) override
Sets or changes the potential of node.
float * msg_temp
Temp Message (for the loopyBP algorithm: class CDecodeLPB): Mat(size: nStates x 1; type: CV_32FC1) ...
Mat Pot
The edge potentials: Mat(size: nStates x nStates; type: CV_32FC1)
vec_pEdge_t from
Parent vertices (and potentials)
Edge * findEdge(size_t srcNode, size_t dstNode) const
Finds and returns the Edge defined by two nodes.
byte group_id
ID of the group, to which the edge belongs.
void setEdgeGroup(size_t srcNode, size_t dstNode, byte group) override
Assigns a directed edge (srcNode) –> (dstNode) to the group group.
void addEdge(size_t srcNode, size_t dstNode, byte group, const Mat &pot) override
Adds an additional directed edge with specified potentional.
std::vector< Node * > vec_pNode_t
void reset(void) override
Resets the graph.
void removeEdge(size_t srcNode, size_t dstNode) override
Removes the specified edge.
std::vector< Edge * > vec_pEdge_t
void setEdge(size_t srcNode, size_t dstNode, const Mat &pot) override
Sets or changes the potentional of directed edge.
bool isEdgeExists(size_t srcNode, size_t dstNode) const override
Checks whether the edge exists.
void setEdges(std::optional< byte > group, const Mat &pot) override
Sets the potential pot to all edges belonging to group group.
virtual ~CGraphWeiss(void)
void getParentNodes(size_t node, vec_size_t &vNodes) const override
Returns the set of IDs of the parent nodes of the argument node.
Node * node1
First node in edge.
Interface class for graphical models.
byte getEdgeGroup(size_t srcNode, size_t dstNode) const override
Returns the group of the edge.
Node * node2
Second node in edge.
size_t getNumNodes(void) const override
Returns the number of nodes in the graph.
CGraphWeiss(byte nStates)
Constructor.
Node(size_t _id, const Mat &p=EmptyMat)