You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goldberg_radzik identifies a negative cycle in situations where there is an isolated component with a negative cycle, and the specified source node for the algorithm is not part of that isolated component. According to the goldberg_radzik documentation, "In the case where the (di)graph is not connected, if a component not containing the source contains a negative (di)cycle, it will not be detected". However, this negative cycle is reported regardless of the source node's connectivity to the component.
This does raise for a negatively weighted selfloop edge. If an edge between two distinct nodes has negative weight it will only cause an error to be raised if it is in the same component as the source. But if that edge is a self-loop, it does get reported whether that is in the same component or not.
@iany0 can you explain your use case and how this impacts you? Perhaps there is a workaround.
The long term fix is either to change the doc_string to explain that behavior is different for negatively weighted self-loops, or to change how we are looking for negative cycles. I'm afraid that this issue exists with many of the shortest_path functions. How it affects you might help us decide how to fix it.
Current Behavior
The
goldberg_radzik
identifies a negative cycle in situations where there is an isolated component with a negative cycle, and the specified source node for the algorithm is not part of that isolated component. According to thegoldberg_radzik
documentation, "In the case where the (di)graph is not connected, if a component not containing the source contains a negative (di)cycle, it will not be detected". However, this negative cycle is reported regardless of the source node's connectivity to the component.Steps to Reproduce
Environment
Python version: 3.9
NetworkX version: 3.2.1
The text was updated successfully, but these errors were encountered: