Class CSRBooleanMatrix

  • All Implemented Interfaces:
    java.io.Serializable

    class CSRBooleanMatrix
    extends java.lang.Object
    implements java.io.Serializable
    A sparse boolean matrix in Compressed Sparse Row (CSR) format.

    This is a helper class for graph representation and thus does not provide a fully fledged matrix.

    • Constructor Summary

      Constructors 
      Constructor Description
      CSRBooleanMatrix​(int rows, int columns, java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> entries)
      Create a new CSR boolean matrix
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int columns()
      Get the number of columns of the matrix.
      int nonZeros​(int row)
      Get the number of non-zero entries of a row.
      java.util.Iterator<java.lang.Integer> nonZerosPositionIterator​(int row)
      Get an iterator over the non-zero entries of a row.
      java.util.Set<java.lang.Integer> nonZerosSet​(int row)
      Get the position of non-zero entries of a row as a set.
      int rows()
      Get the number of rows of the matrix.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INTEGER_PAIR_LEX_COMPARATOR

        private static final java.util.Comparator<Pair<java.lang.Integer,​java.lang.Integer>> INTEGER_PAIR_LEX_COMPARATOR
      • columns

        private int columns
      • rowOffsets

        private int[] rowOffsets
      • columnIndices

        private int[] columnIndices
    • Constructor Detail

      • CSRBooleanMatrix

        public CSRBooleanMatrix​(int rows,
                                int columns,
                                java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> entries)
        Create a new CSR boolean matrix
        Parameters:
        rows - the number of rows
        columns - the number of columns
        entries - the position of the entries of the matrix
    • Method Detail

      • columns

        public int columns()
        Get the number of columns of the matrix.
        Returns:
        the number of columns
      • rows

        public int rows()
        Get the number of rows of the matrix.
        Returns:
        the number of rows
      • nonZeros

        public int nonZeros​(int row)
        Get the number of non-zero entries of a row.
        Parameters:
        row - the row
        Returns:
        the number of non-zero entries of a row
      • nonZerosPositionIterator

        public java.util.Iterator<java.lang.Integer> nonZerosPositionIterator​(int row)
        Get an iterator over the non-zero entries of a row.
        Parameters:
        row - the row
        Returns:
        an iterator over the non-zero entries of a row
      • nonZerosSet

        public java.util.Set<java.lang.Integer> nonZerosSet​(int row)
        Get the position of non-zero entries of a row as a set.
        Parameters:
        row - the row
        Returns:
        the position of non-zero entries of a row as a set.