thomasp85 / tidygraph

A tidy API for graph manipulation
https://tidygraph.data-imaginist.com
Other
546 stars 61 forks source link

`centrality_katz` and other netrankr-dependent metrics do not work on directed networks #126

Closed ashander closed 11 months ago

ashander commented 4 years ago

This is a known issue with netrankr but is not noted in the docs for tidygraph currently.

Example:

g <- graph(c(1, 2, 2, 3, 3, 1))
g %>% as_tbl_graph() %>% activate(nodes) %>% mutate(k = centrality_katz())
#Error: Problem with `mutate()` input `k`.
#x invalid 'type' (complex) of argument
#i Input `k` is `centrality_katz()`.
Run `rlang::last_error()` to see where the error occurred.

This is caused by netrankr::walks_attenuated calling max(x) where x is a complex-valued set of eigenvalues: https://github.com/schochastics/netrankr/blob/master/R/indirect.relations.R#L177