refactor: use assert_character() instead of as.character()
Current Aviator status
Aviator will automatically update this comment as the status of the PR changes. Comment
/aviator refreshto force Aviator to re-examine your PR (or learn about other/aviatorcommands).
This pull request is currently open (not queued).
How to merge
To merge this PR, comment /aviator merge or add the mergequeue label.
I'm not experienced enough with R to be able to follow the code without considerable time investment, but I wanted to point out that in many cases, numerical vertex IDs or vertex names are auto-converted to characters. This is convenient and probably desirable. I do not know if this change breaks any of the relevant use cases, but it's good to pay attention here.
@szhorvat thanks! Yes, I'm hoping the revdeps checks would help with that. If this breaks too many things, I won't merge it.
And just another reminder that our users are not just dependent packages, but also individuals who use igraph for research, often interactively. Unfortunately it is difficult to track this second kind of user, even though IMO they are the majority.
@schochastics curious to hear what you think about this. We might also close the PR.
I think this PR is a good idea, because it forces user to be rational on naming attributes. But given that the reprex below currently works, I am not sure if we are opening some pandoras box with it?
library(igraph)
#>
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#>
#> decompose, spectrum
#> The following object is masked from 'package:base':
#>
#> union
g <- sample_gnp(10,0.2)
g$`5` <- 4
g
#> IGRAPH 9a520e7 U--- 10 3 -- Erdos-Renyi (gnp) graph
#> + attr: name (g/c), type (g/c), loops (g/l), p (g/n), 5 (g/n)
#> + edges from 9a520e7:
#> [1] 2--3 1--4 1--8
graph_attr(g,5)
#> [1] 4
delete_graph_attr(g,5)
#> IGRAPH 9a520e7 U--- 10 3 -- Erdos-Renyi (gnp) graph
#> + attr: name (g/c), type (g/c), loops (g/l), p (g/n)
#> + edges from 9a520e7:
#> [1] 2--3 1--4 1--8
Created on 2025-03-25 with reprex v2.1.1
set_graph_attr should also use the assert function
Crazy idea: add a lifecycle compatibility layer that doesn't break existing code (which I'd consider off-label use, but keeping compat is a gesture of goodwill)?
Crazy idea: add a lifecycle compatibility layer that doesn't break existing code (which I'd consider off-label use, but keeping compat is a gesture of goodwill)?
can we decide after we've seen the revdeps results?
Thanks!