AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.test.AdjacencyMatrixTest Class Reference

Public Member Functions

void testMatrix ()
 
void testSymmatrixMatrix ()
 

Static Public Member Functions

static void main (String args[])
 

Detailed Description

Definition at line 8 of file AdjacencyMatrixTest.java.

Member Function Documentation

◆ main()

static void aud.test.AdjacencyMatrixTest.main ( String  args[])
static

Definition at line 46 of file AdjacencyMatrixTest.java.

46 {
47 org.junit.runner.JUnitCore.main("aud.test.AdjacencyMatrixTest");
48 }

◆ testMatrix()

void aud.test.AdjacencyMatrixTest.testMatrix ( )

Definition at line 11 of file AdjacencyMatrixTest.java.

11 {
12 AdjacencyMatrix<Integer> m=new AdjacencyMatrix<Integer>(false);
13 assertFalse(m.isSymmetricMatrix());
14
15 m.set(1,1,1); m.set(1,2,4); m.set(1,3,7);
16 m.set(2,1,2); m.set(2,2,5); m.set(2,3,8);
17 m.set(3,1,3); m.set(3,2,6); m.set(3,3,9);
18
19 assertSame(m.nnz(),9);
20
21 m.clearColumnAndRow(2);
22
23 assertSame(m.nnz(),4);
24 assertSame(m.get(1,1),1); assertSame(m.get(1,3),7);
25 assertSame(m.get(3,1),3); assertSame(m.get(3,3),9);
26 }

References aud.graph.AdjacencyMatrix< Edge >.clearColumnAndRow(), aud.graph.matrix.SparseMatrixCS< T >.get(), aud.graph.matrix.SparseMatrix< T >.isSymmetricMatrix(), aud.graph.matrix.SparseMatrixCS< T >.nnz(), and aud.graph.matrix.SparseMatrix< T >.set().

+ Here is the call graph for this function:

◆ testSymmatrixMatrix()

void aud.test.AdjacencyMatrixTest.testSymmatrixMatrix ( )

Definition at line 29 of file AdjacencyMatrixTest.java.

29 {
30 AdjacencyMatrix<Integer> m=new AdjacencyMatrix<Integer>(true);
31 assertTrue(m.isSymmetricMatrix());
32
33 m.set(1,1,1);
34 m.set(2,1,2); m.set(2,2,4);
35 m.set(3,1,3); m.set(3,2,5); m.set(3,3,6);
36
37 assertSame(m.nnz(),9);
38
39 m.clearColumnAndRow(2);
40
41 assertSame(m.nnz(),4);
42 assertSame(m.get(1,1),1); assertSame(m.get(1,3),3);
43 assertSame(m.get(3,1),3); assertSame(m.get(3,3),6);
44 }

References aud.graph.AdjacencyMatrix< Edge >.clearColumnAndRow(), aud.graph.matrix.SparseMatrixCS< T >.get(), aud.graph.matrix.SparseMatrix< T >.isSymmetricMatrix(), aud.graph.matrix.SparseMatrixCS< T >.nnz(), and aud.graph.matrix.SparseMatrix< T >.set().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: