File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -30,5 +30,31 @@ public void CalculatePageRank_Should_Calculate_Correct_PageRank()
3030
3131 Assert . True ( Math . Abs ( result [ c ] - 0.35625 ) < 0.0001 ) ;
3232 }
33+
34+ [ Fact ]
35+ public void CalculatePageRank_Should_Calculate_Correct_PageRank_Wiki ( )
36+ {
37+ var g = new Graph < string , byte > ( ) ;
38+
39+ uint a = g . AddNode ( "A" ) ;
40+ uint b = g . AddNode ( "B" ) ;
41+ uint c = g . AddNode ( "C" ) ;
42+ uint d = g . AddNode ( "D" ) ;
43+
44+ g . Connect ( a , b , 0 , 0 ) ;
45+ g . Connect ( a , d , 0 , 0 ) ;
46+ g . Connect ( b , a , 0 , 0 ) ;
47+ g . Connect ( c , b , 0 , 0 ) ;
48+ g . Connect ( c , a , 0 , 0 ) ;
49+ g . Connect ( d , c , 0 , 0 ) ;
50+
51+
52+ var result = g . CalculatePageRank ( ) ;
53+
54+ Assert . True ( Math . Abs ( result [ a ] - 0.35 ) < 0.01 ) ;
55+ Assert . True ( Math . Abs ( result [ b ] - 0.29 ) < 0.01 ) ;
56+ Assert . True ( Math . Abs ( result [ c ] - 0.15 ) < 0.01 ) ;
57+ Assert . True ( Math . Abs ( result [ d ] - 0.18 ) < 0.01 ) ;
58+ }
3359 }
3460}
You can’t perform that action at this time.
0 commit comments