Skip to content

knn test failure in b-next #2190

@maelle

Description

@maelle

I have saved the edgelist of the graph that's created at

g4 <- sample_gnp(1000, p = 5 / 1000)
r4 <- knn(g4)
expect_equal(r4$knn[1000], 20 / 3)
expect_equal(length(r4$knnk), 15)
expect_equal(r4$knnk[12], 19 / 3)

bla.txt

b-next

devtools::load_all()
#> ℹ Loading igraph
g4 <- read_graph("bla.txt")
r4 <- knn(g4)
r4$knn[1000] # 20 / 3
#> [1] 5
length(r4$knnk) # 15
#> [1] 15
r4$knnk[12] # 19 / 3
#> [1] 5.638889

main

library("igraph")
#> 
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#> 
#>     decompose, spectrum
#> The following object is masked from 'package:base':
#> 
#>     union
g4 <- read_graph("bla.txt")
r4 <- knn(g4)
r4$knn[1000] # 20 / 3
#> [1] 5
length(r4$knnk) # 15
#> [1] 15
r4$knnk[12] # 19 / 3
#> [1] 5.638889

Created on 2025-10-03 with reprex v2.1.1

So actually it is the same. To me it means that now for whatever reason in the test we are not drawing the same graph any more.

@schochastics would you recommend:

  • updating the expectation
  • splitting the test so that in the future we have better control of what the random graph is?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions