Class Rk

  • All Implemented Interfaces:
    F

    public class Rk
    extends Object
    implements F
    Random heuristic
    Since:
    01/01/2014
    Author:
    Jean-Guillaume Fages
    • Field Detail

      • defaultKValue

        public static int defaultKValue
        number of random iterations
      • n

        protected int n
      • k

        protected int k
      • iter

        protected int iter
      • inMIS

        protected BitSet inMIS
    • Constructor Detail

      • Rk

        public Rk​(UndirectedGraph graph,
                  int k)
        Creates an instance of the Random heuristic to compute independent sets on graph
        Parameters:
        graph - on which IS have to be computed
        k - number of iterations (i.e. number of expected IS per propagation)
      • Rk

        public Rk​(UndirectedGraph graph)
        Creates an instance of the Random heuristic to compute independent sets on graph uses the default setting DEFAULT_K=30
        Parameters:
        graph - on which IS have to be computed
    • Method Detail

      • prepare

        public void prepare()
        Description copied from interface: F
        Potentially performs some calculation before computing independent sets
        Specified by:
        prepare in interface F
      • computeMIS

        public void computeMIS()
        Description copied from interface: F
        Computes an Independent Set as large as possible, although it is not necessarily maximum
        Specified by:
        computeMIS in interface F
      • getMIS

        public BitSet getMIS()
        Specified by:
        getMIS in interface F
        Returns:
        a BitSet representing vertices that belong to the independent set
      • hasNextMIS

        public boolean hasNextMIS()
        Specified by:
        hasNextMIS in interface F
        Returns:
        true iff the heuristic can compute another independent set