Class FloydWarshallNegativeLengthCycleStrategy

    • Constructor Detail

      • FloydWarshallNegativeLengthCycleStrategy

        public FloydWarshallNegativeLengthCycleStrategy​(Graph graph,
                                                        ToDoubleMapping edgeLengths)
        Constructs negative cycle detection analyzer for a given graph and given edge values.
        Parameters:
        graph - The given graph.
        edgeLengths - The lengths associated with the given graph.
    • Method Detail

      • hasNegativeLengthCycle

        public boolean hasNegativeLengthCycle()
        Return true if a negative cycle exists in the graph under analysis.
        Specified by:
        hasNegativeLengthCycle in interface NegativeLengthCycleAnalyzer
        Returns:
        True if the graph has a negative cycle.
      • toString

        public java.lang.String toString()
        Return a description of the analyzer.
        Specified by:
        toString in interface Analyzer
        Overrides:
        toString in class CachedStrategy
        Returns:
        Return a description of the analyzer..
      • valid

        public boolean valid()
        Check for compatibility between the analysis and the given graph. A graph needs to be an instance of a DirectedGraph in order to use this algorithm.
        Specified by:
        valid in interface Analyzer
        Returns:
        True if the graph is a directed and cyclic graph.
      • _compute

        protected java.lang.Object _compute()
        The computation associated with the Floyd-Warshall algorithm.
        Overrides:
        _compute in class CachedStrategy
        Returns:
        Return a true Boolean Object if the graph has a negative cycle.