Class AhujaOrlinSharmaCyclicExchangeLocalAugmentation.LabeledPath<V>

  • Type Parameters:
    V - the vertex type
    All Implemented Interfaces:
    java.lang.Cloneable
    Enclosing class:
    AhujaOrlinSharmaCyclicExchangeLocalAugmentation<V,​E>

    private class AhujaOrlinSharmaCyclicExchangeLocalAugmentation.LabeledPath<V>
    extends java.lang.Object
    implements java.lang.Cloneable
    Implementation of a labeled path. It is used in AhujaOrlinSharmaCyclicExchangeLocalAugmentation to efficiently maintain the paths in the calculation.
    Since:
    June 7, 2018
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double cost
      the cost of the path
      java.util.HashSet<java.lang.Integer> labels
      the labels the path contains
      java.util.ArrayList<V> vertices
      the vertices in the path
    • Constructor Summary

      Constructors 
      Constructor Description
      LabeledPath​(java.util.ArrayList<V> vertices, double cost, java.util.HashSet<java.lang.Integer> labels)
      Constructs a LabeledPath with the given inputs
    • Field Detail

      • vertices

        public java.util.ArrayList<V> vertices
        the vertices in the path
      • labels

        public java.util.HashSet<java.lang.Integer> labels
        the labels the path contains
      • cost

        public double cost
        the cost of the path
    • Constructor Detail

      • LabeledPath

        public LabeledPath​(java.util.ArrayList<V> vertices,
                           double cost,
                           java.util.HashSet<java.lang.Integer> labels)
        Constructs a LabeledPath with the given inputs
        Parameters:
        vertices - the vertices of the path in order of the path
        cost - the cost of the edges connecting the vertices
        labels - the mapping of the vertices to labels (subsets)
    • Method Detail

      • addVertex

        public void addVertex​(V v,
                              double edgeCost,
                              int label)
        Adds a vertex to the path
        Parameters:
        v - the vertex
        edgeCost - the cost of the edge connecting the last vertex of the path and the new vertex
        label - the label of the new vertex
      • getHead

        public V getHead()
        Returns the start vertex of the path
        Returns:
        the start vertex of the path
      • getTail

        public V getTail()
        Returns the end vertex of the path
        Returns:
        the end vertex of the path
      • isEmpty

        public boolean isEmpty()
        Returns whether the path is empty, i.e. has no vertices
        Returns:
        whether the path is empty
      • clone

        public AhujaOrlinSharmaCyclicExchangeLocalAugmentation.LabeledPath<V> clone()
        Returns a shallow copy of this labeled path instance. Vertices are not cloned.
        Overrides:
        clone in class java.lang.Object
        Returns:
        a shallow copy of this path.
        Throws:
        java.lang.RuntimeException - in case the clone is not supported
        See Also:
        Object.clone()