24 #ifndef DOXYGEN_SHOULD_SKIP_THIS 37 if (ref.size() != test.size()) {
38 GUM_ERROR(OperationNotAllowed,
"Graphs of different sizes");
40 for (
const NodeId node : ref.asNodeSet()) {
41 if (!test.existsNode(node)) {
42 GUM_ERROR(InvalidNode,
"Test doesn't contain all nodes from ref");
59 for (
const Arc& arc : ref.arcs()) {
60 if (test.existsArc(arc)) {
62 }
else if (test.existsArc(arc.head(), arc.tail())) {
68 for (
const Arc& arc : test.arcs()) {
69 if (!ref.existsArc(arc) && !ref.existsArc(arc.head(), arc.tail())) {
79 if (ref.size() != test.size()) {
80 GUM_ERROR(OperationNotAllowed,
"Graphs of different sizes");
82 for (
const NodeId node : ref.asNodeSet()) {
83 if (!test.existsNode(node)) {
84 GUM_ERROR(InvalidNode,
"Test doesn't contain all nodes from ref");
101 for (
const Edge& edge : ref.edges()) {
102 if (test.existsEdge(edge)) {
108 for (
const Edge& edge : test.edges()) {
117 const MixedGraph& test) {
118 if (ref.size() != test.size()) {
119 GUM_ERROR(OperationNotAllowed,
"Graphs of different sizes");
121 for (
const NodeId node : ref.asNodeSet()) {
122 if (!test.existsNode(node)) {
123 GUM_ERROR(InvalidNode,
"Test doesn't contain all nodes from ref");
139 for (
const Arc& arc : ref.arcs()) {
140 if (test.existsArc(arc)) {
142 }
else if (test.existsArc(arc.head(), arc.tail())) {
144 }
else if (test.existsEdge(arc.tail(), arc.head())) {
150 for (
const Edge& edge : ref.edges()) {
151 if (test.existsEdge(edge)) {
153 }
else if (test.existsArc(edge.first(), edge.second())
154 || test.existsArc(edge.second(), edge.first())) {
160 for (
const Arc& arc : test.arcs()) {
161 if (!ref.existsArc(arc) && !ref.existsArc(arc.head(), arc.tail())
162 && !ref.existsEdge(arc.tail(), arc.head())) {
166 for (
const Edge& edge : test.edges()) {
167 if (!ref.existsEdge(edge) && !ref.existsArc(edge.first(), edge.second())
168 && !ref.existsArc(edge.second(), edge.first())) {
183 precision = tp / (tp + fp);
192 recall = tp / (tp + fn);
203 precision = tp / (tp + fp);
204 recall = tp / (tp + fn);
205 f_score = 2 * precision * recall / (precision +
recall);
214 precision = tp / (tp + fp);
222 recall = tp / (tp + fn);
233 precision = tp / (tp + fp);
234 recall = tp / (tp + fn);
236 f_score = 2 * precision * recall / (precision +
recall);
double f_score_skeleton() const
compare two DiGraphs
double recall_skeleton() const
compare two DiGraphs
double f_score() const
compare two DiGraphs
gum is the global namespace for all aGrUM entities
double precision() const
Measures for the graphs.
double recall() const
compare two DiGraphs
StructuralComparator()
default constructor
A class for comparing graphs based on their structures.
void compare(const DiGraph &ref, const DiGraph &test)
compare two DiGraphs
double __true_edge
Confusion matrix.
double precision_skeleton() const
Measures for the skeleton, aka graph without orientations.
~StructuralComparator()
destructor
Size NodeId
Type for node ids.
#define GUM_ERROR(type, msg)