MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / test_pagerank

Function test_pagerank

tests/unit/test_pagerank.c:26–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24#include "acutest.h"
25
26void test_pagerank() {
27 GrB_Matrix A;
28 GrB_Info info;
29 double tol = 1e-4 ;
30 int iters, itermax = 100 ;
31 LAGraph_PageRank *ranking = NULL;
32
33 /* Graph on the cover of the book, 'Graph Algorithms in the language of linear algebra'.
34 A = [
35 0 0 0 1 0 0 0
36 1 0 0 0 0 0 0
37 0 0 0 1 0 1 1
38 1 0 0 0 0 0 1
39 0 1 0 0 0 0 1
40 0 0 1 0 1 0 0
41 0 1 0 0 0 0 0 ] ;
42 */
43
44 info = GrB_Matrix_new(&A, GrB_BOOL, 7, 7);
45 TEST_ASSERT(info == GrB_SUCCESS);
46
47 info = GrB_Matrix_setElement_BOOL(A, true, 3, 0);
48 TEST_ASSERT(info == GrB_SUCCESS);
49
50 info = GrB_Matrix_setElement_BOOL(A, true, 0, 1);
51 TEST_ASSERT(info == GrB_SUCCESS);
52
53 info = GrB_Matrix_setElement_BOOL(A, true, 3, 2);
54 TEST_ASSERT(info == GrB_SUCCESS);
55
56 info = GrB_Matrix_setElement_BOOL(A, true, 5, 2);
57 TEST_ASSERT(info == GrB_SUCCESS);
58
59 info = GrB_Matrix_setElement_BOOL(A, true, 6, 2);
60 TEST_ASSERT(info == GrB_SUCCESS);
61
62 info = GrB_Matrix_setElement_BOOL(A, true, 0, 3);
63 TEST_ASSERT(info == GrB_SUCCESS);
64
65 info = GrB_Matrix_setElement_BOOL(A, true, 6, 3);
66 TEST_ASSERT(info == GrB_SUCCESS);
67
68 info = GrB_Matrix_setElement_BOOL(A, true, 1, 4);
69 TEST_ASSERT(info == GrB_SUCCESS);
70
71 info = GrB_Matrix_setElement_BOOL(A, true, 6, 4);
72 TEST_ASSERT(info == GrB_SUCCESS);
73
74 info = GrB_Matrix_setElement_BOOL(A, true, 2, 5);
75 TEST_ASSERT(info == GrB_SUCCESS);
76
77 info = GrB_Matrix_setElement_BOOL(A, true, 4, 5);
78 TEST_ASSERT(info == GrB_SUCCESS);
79
80 info = GrB_Matrix_setElement_BOOL(A, true, 1, 6);
81 TEST_ASSERT(info == GrB_SUCCESS);
82
83 Pagerank(&ranking, A, itermax, tol, &iters);

Callers

nothing calls this directly

Calls 3

GrB_Matrix_newFunction · 0.85
PagerankFunction · 0.85
rm_freeFunction · 0.85

Tested by

no test coverage detected