K iDdZgdZGddeZGddeZGddeZGdd eZGd d eZGd d eZGddeZ GddeZ GddeZ GddeZ GddeZ GddeZGddeZGddeZy)zL ********** Exceptions ********** Base exceptions and errors for NetworkX. ) HasACycle NodeNotFoundPowerIterationFailedConvergenceExceededMaxIterationsAmbiguousSolutionNetworkXAlgorithmErrorNetworkXException NetworkXErrorNetworkXNoCycleNetworkXNoPathNetworkXNotImplementedNetworkXPointlessConceptNetworkXUnboundedNetworkXUnfeasibleceZdZdZy)rz&Base class for exceptions in NetworkX.N__name__ __module__ __qualname____doc__X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/networkx/exception.pyrrs0rrceZdZdZy)r z)Exception for a serious error in NetworkXNrrrrr r s3rr ceZdZdZy)r aRaised when a null graph is provided as input to an algorithm that cannot use it. The null graph is sometimes considered a pointless concept [1]_, thus the name of the exception. Notes ----- Null graphs and empty graphs are often used interchangeably but they are well defined in NetworkX. An ``empty_graph`` is a graph with ``n`` nodes and 0 edges, and a ``null_graph`` is a graph with 0 nodes and 0 edges. References ---------- .. [1] Harary, F. and Read, R. "Is the Null Graph a Pointless Concept?" In Graphs and Combinatorics Conference, George Washington University. New York: Springer-Verlag, 1973. Nrrrrr r #srr ceZdZdZy)rz3Exception for unexpected termination of algorithms.Nrrrrrr9s=rrceZdZdZy)rzdException raised by algorithms trying to solve a problem instance that has no feasible solution.Nrrrrrr=s/rrceZdZdZy)r zoException for algorithms that should return a path when running on graphs where such a path does not exist.Nrrrrr r Bs3rr ceZdZdZy)r zqException for algorithms that should return a cycle when running on graphs where such a cycle does not exist.Nrrrrr r Gs4rr ceZdZdZy)rz^Raised if a graph has a cycle when an algorithm expects that it will have no cycles. NrrrrrrLsrrceZdZdZy)rzwException raised by algorithms trying to solve a maximization or a minimization problem instance that is unbounded.NrrrrrrSs=rrceZdZdZy)r zCException raised by algorithms not implemented for a type of graph.Nrrrrr r XsMrr ceZdZdZy)rz>Exception raised if requested node is not present in the graphNrrrrrr\sHrrceZdZdZy)ra@Raised if more than one valid solution exists for an intermediary step of an algorithm. In the face of ambiguity, refuse the temptation to guess. This may occur, for example, when trying to determine the bipartite node sets in a disconnected bipartite graph when computing bipartite matchings. Nrrrrrr`srrceZdZdZy)rzRaised if a loop iterates too many times without breaking. This may occur, for example, in an algorithm that computes progressively better approximations to a value but exceeds an iteration bound specified by the user. Nrrrrrrlsrrc"eZdZdZfdZxZS)rzRaised when the power iteration method fails to converge within a specified iteration limit. `num_iterations` is the number of iterations that have been completed when this exception was raised. cDd|d}|}t|}|||g|i|y)Nz*power iteration failed to converge within z iterations)super__init__)selfnum_iterationsargskwmsgexception_message superinit __class__s rr(z(PowerIterationFailedConvergence.__init__s7:>:J+VG$ $)7D7B7r)rrrrr( __classcell__)r0s@rrrvs88rrN)r__all__ Exceptionrr r rrr r rrr rrrrrrrr4s $1 14%40,>.>/// 3'3 4(4 !=.= N.NI$I ) - 8&; 8r