We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 88e8987 commit 3ca9d01Copy full SHA for 3ca9d01
1 file changed
mst_test.go
@@ -1,6 +1,7 @@
1
package graph
2
3
import (
4
+ "math/rand"
5
"testing"
6
)
7
@@ -30,3 +31,16 @@ func TestMST(t *testing.T) {
30
31
t.Errorf("MST: %s", mess)
32
}
33
34
+
35
+func BenchmarkMST(b *testing.B) {
36
+ n := 1000
37
+ b.StopTimer()
38
+ g := New(n)
39
+ for i := 0; i < n; i++ {
40
+ g.AddBoth(rand.Intn(n), rand.Intn(n))
41
+ }
42
+ b.StartTimer()
43
+ for i := 0; i < b.N; i++ {
44
+ _ = MST(g)
45
46
+}
0 commit comments