Class CSRBooleanMatrix

java.lang.Object
org.jgrapht.opt.graph.sparse.specifics.CSRBooleanMatrix
All Implemented Interfaces:
Serializable

class CSRBooleanMatrix extends Object implements 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.

  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • INTEGER_PAIR_LEX_COMPARATOR

      private static final Comparator<Pair<Integer,Integer>> INTEGER_PAIR_LEX_COMPARATOR
    • columns

      private int columns
    • rowOffsets

      private int[] rowOffsets
    • columnIndices

      private int[] columnIndices
  • Constructor Details

    • CSRBooleanMatrix

      public CSRBooleanMatrix(int rows, int columns, List<Pair<Integer,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 Details

    • 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 Iterator<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 Set<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.