26 #ifndef DOXYGEN_SHOULD_SKIP_THIS 39 if (ref.size() != test.size()) {
40 GUM_ERROR(OperationNotAllowed,
"Graphs of different sizes");
42 for (
const NodeId node: ref.asNodeSet()) {
43 if (!test.existsNode(node)) {
44 GUM_ERROR(InvalidNode,
"Test doesn't contain all nodes from ref");
61 for (
const Arc& arc: ref.arcs()) {
62 if (test.existsArc(arc)) {
64 }
else if (test.existsArc(arc.head(), arc.tail())) {
70 for (
const Arc& arc: test.arcs()) {
71 if (!ref.existsArc(arc) && !ref.existsArc(arc.head(), arc.tail())) {
81 if (ref.size() != test.size()) {
82 GUM_ERROR(OperationNotAllowed,
"Graphs of different sizes");
84 for (
const NodeId node: ref.asNodeSet()) {
85 if (!test.existsNode(node)) {
86 GUM_ERROR(InvalidNode,
"Test doesn't contain all nodes from ref");
103 for (
const Edge& edge: ref.edges()) {
104 if (test.existsEdge(edge)) {
110 for (
const Edge& edge: test.edges()) {
119 const MixedGraph& test) {
120 if (ref.size() != test.size()) {
121 GUM_ERROR(OperationNotAllowed,
"Graphs of different sizes");
123 for (
const NodeId node: ref.asNodeSet()) {
124 if (!test.existsNode(node)) {
125 GUM_ERROR(InvalidNode,
"Test doesn't contain all nodes from ref");
141 for (
const Arc& arc: ref.arcs()) {
142 if (test.existsArc(arc)) {
144 }
else if (test.existsArc(arc.head(), arc.tail())) {
146 }
else if (test.existsEdge(arc.tail(), arc.head())) {
152 for (
const Edge& edge: ref.edges()) {
153 if (test.existsEdge(edge)) {
155 }
else if (test.existsArc(edge.first(), edge.second())
156 || test.existsArc(edge.second(), edge.first())) {
162 for (
const Arc& arc: test.arcs()) {
163 if (!ref.existsArc(arc) && !ref.existsArc(arc.head(), arc.tail())
164 && !ref.existsEdge(arc.tail(), arc.head())) {
168 for (
const Edge& edge: test.edges()) {
169 if (!ref.existsEdge(edge) && !ref.existsArc(edge.first(), edge.second())
170 && !ref.existsArc(edge.second(), edge.first())) {
185 precision = tp / (tp + fp);
194 recall = tp / (tp + fn);
205 precision = tp / (tp + fp);
206 recall = tp / (tp + fn);
207 f_score = 2 * precision * recall / (precision +
recall);
216 precision = tp / (tp + fp);
224 recall = tp / (tp + fn);
235 precision = tp / (tp + fp);
236 recall = tp / (tp + fn);
238 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
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
double precision() const
Measures for the graphs.
double recall() const
compare two DiGraphs
StructuralComparator()
default constructor
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
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)