- java.lang.Object
-
- org.jgrapht.opt.graph.sparse.specifics.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
CSRBooleanMatrix.NonZerosIterator
-
Field Summary
Fields Modifier and Type Field Description private int[]
columnIndices
private int
columns
private static java.util.Comparator<Pair<java.lang.Integer,java.lang.Integer>>
INTEGER_PAIR_LEX_COMPARATOR
private int[]
rowOffsets
private static long
serialVersionUID
-
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.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
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 rowscolumns
- the number of columnsentries
- 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.
-
-