XNetwork 1.7.5; VERSION ${PROJECT_VERSION}
Loading...
Searching...
No Matches
exception.hpp
Go to the documentation of this file.
1
9// -*- coding: utf-8 -*-
10#pragma once
11
12#include <stdexcept>
13#include <string>
14#include <string_view>
15
16namespace xnetwork {
17
18 // static const auto __all__ = {
19 // "HasACycle",
20 // "NodeNotFound",
21 // "PowerIterationFailedConvergence",
22 // "ExceededMaxIterations",
23 // "AmbiguousSolution",
24 // "XNetworkAlgorithmError",
25 // "XNetworkException",
26 // "XNetworkError",
27 // "XNetworkNoCycle",
28 // "XNetworkNoPath",
29 // "XNetworkNotImplemented",
30 // "XNetworkPointlessConcept",
31 // "XNetworkUnbounded",
32 // "XNetworkUnfeasible",
33 // };
34
36 struct XNetworkException : std::runtime_error {
37 explicit XNetworkException(std::string_view msg) : std::runtime_error(std::string(msg)) {}
38 };
39
42 explicit XNetworkError(std::string_view msg) : XNetworkException(msg) {}
43 };
44
51
56
61
64 explicit XNetworkNoPath(std::string_view msg) : XNetworkUnfeasible(msg) {}
65 };
66
69 explicit XNetworkNoCycle(std::string_view msg) : XNetworkUnfeasible(msg) {}
70 };
71
74 explicit HasACycle(std::string_view msg) : XNetworkException(msg) {}
75 };
76
81
86
89 explicit NodeNotFound(std::string_view msg) : XNetworkException(msg) {}
90 };
91
97 explicit AmbiguousSolution(std::string_view msg) : XNetworkException(msg) {}
98 };
99
106
107 // /** Raised when the power iteration method fails to converge within a
108 // specified iteration limit.
109 //
110 // `num_iterations` is the number of iterations that have been
111 // completed when this exception was raised.
112 //
113 // */
114 // class PowerIterationFailedConvergence : ExceededMaxIterations {
115 // explicit _Self( num_iterations, *args, **kw) {
116 // const auto msg = "power iteration failed to converge within {}
117 // iterations"; exception_message = msg.format(num_iterations);
118 // superinit = super(PowerIterationFailedConvergence, *this).__init__
119 // superinit( exception_message, *args, **kw);
120 // }
121 // };
122} // namespace xnetwork
Read-only map of maps of maps (view into a dict-of-dict-of-dict structure)
Definition coreviews.hpp:109
Definition hadlock.hpp:32
Definition digraphs.hpp:24
Raised when more than one valid solution exists for an intermediary step of an algorithm.
Definition exception.hpp:96
AmbiguousSolution(std::string_view msg)
Definition exception.hpp:97
Raised when a loop exceeds the maximum number of iterations.
Definition exception.hpp:103
ExceededMaxIterations(std::string_view msg)
Definition exception.hpp:104
Raised if a graph has a cycle when an algorithm expects no cycles.
Definition exception.hpp:73
HasACycle(std::string_view msg)
Definition exception.hpp:74
Exception raised when a requested node is not present in the graph.
Definition exception.hpp:88
NodeNotFound(std::string_view msg)
Definition exception.hpp:89
Exception for unexpected termination of algorithms.
Definition exception.hpp:53
XNetworkAlgorithmError(std::string_view msg)
Definition exception.hpp:54
Exception for a serious error in XNetwork.
Definition exception.hpp:41
XNetworkError(std::string_view msg)
Definition exception.hpp:42
Base class for all XNetwork exceptions.
Definition exception.hpp:36
XNetworkException(std::string_view msg)
Definition exception.hpp:37
Exception for algorithms that should return a cycle when running on graphs where such a cycle does no...
Definition exception.hpp:68
XNetworkNoCycle(std::string_view msg)
Definition exception.hpp:69
Exception for algorithms that should return a path when running on graphs where such a path does not ...
Definition exception.hpp:63
XNetworkNoPath(std::string_view msg)
Definition exception.hpp:64
Exception raised by algorithms not implemented for a type of graph.
Definition exception.hpp:83
XNetworkNotImplemented(std::string_view msg)
Definition exception.hpp:84
Raised when a null graph is provided as input to an algorithm that cannot use it.
Definition exception.hpp:48
XNetworkPointlessConcept(std::string_view msg)
Definition exception.hpp:49
Exception raised when a maximization or minimization problem instance is unbounded.
Definition exception.hpp:78
XNetworkUnbounded(std::string_view msg)
Definition exception.hpp:79
Exception raised by algorithms trying to solve a problem instance that has no feasible solution.
Definition exception.hpp:58
XNetworkUnfeasible(std::string_view msg)
Definition exception.hpp:59