XNetwork 1.7.8
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
62
66 explicit XNetworkNoPath(std::string_view msg) : XNetworkUnfeasible(msg) {}
67 };
68
72 explicit XNetworkNoCycle(std::string_view msg) : XNetworkUnfeasible(msg) {}
73 };
74
77 explicit HasACycle(std::string_view msg) : XNetworkException(msg) {}
78 };
79
84
89
92 explicit NodeNotFound(std::string_view msg) : XNetworkException(msg) {}
93 };
94
101 explicit AmbiguousSolution(std::string_view msg) : XNetworkException(msg) {}
102 };
103
110
111 // /** Raised when the power iteration method fails to converge within a
112 // specified iteration limit.
113 //
114 // `num_iterations` is the number of iterations that have been
115 // completed when this exception was raised.
116 //
117 // */
118 // class PowerIterationFailedConvergence : ExceededMaxIterations {
119 // explicit _Self( num_iterations, *args, **kw) {
120 // const auto msg = "power iteration failed to converge within {}
121 // iterations"; exception_message = msg.format(num_iterations);
122 // superinit = super(PowerIterationFailedConvergence, *this).__init__
123 // superinit( exception_message, *args, **kw);
124 // }
125 // };
126} // 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:100
AmbiguousSolution(std::string_view msg)
Definition exception.hpp:101
Raised when a loop exceeds the maximum number of iterations.
Definition exception.hpp:107
ExceededMaxIterations(std::string_view msg)
Definition exception.hpp:108
Raised if a graph has a cycle when an algorithm expects no cycles.
Definition exception.hpp:76
HasACycle(std::string_view msg)
Definition exception.hpp:77
Exception raised when a requested node is not present in the graph.
Definition exception.hpp:91
NodeNotFound(std::string_view msg)
Definition exception.hpp:92
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:71
XNetworkNoCycle(std::string_view msg)
Definition exception.hpp:72
Exception for algorithms that should return a path when running on graphs where such a path does not ...
Definition exception.hpp:65
XNetworkNoPath(std::string_view msg)
Definition exception.hpp:66
Exception raised by algorithms not implemented for a type of graph.
Definition exception.hpp:86
XNetworkNotImplemented(std::string_view msg)
Definition exception.hpp:87
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:81
XNetworkUnbounded(std::string_view msg)
Definition exception.hpp:82
Exception raised by algorithms trying to solve a problem instance that has no feasible solution.
Definition exception.hpp:59
XNetworkUnfeasible(std::string_view msg)
Definition exception.hpp:60