net_by_eigenvector() and mode_by_eigenvector() both fail on a multilevel
network:
devtools::load_all(".")
net_by_eigenvector(fict_marvel)
#> Error: Non-bipartite edge found in bipartite projection. Invalid value
mode_by_eigenvector(fict_actually)
#> Error: Non-bipartite edge found in bipartite projection. Invalid value
Both bundled multilevel datasets fail: fict_marvel and fict_actually. They
are the only two, and a sweep of every exported measure against both shows
these are the only remaining functions with this fault.
Cause
fict_marvel reports is_twomode() TRUE, is_multilevel() TRUE. The
is_twomode() guards at
R/measure_centrality_eigen.R:109, 173, 531
then reach to_mode1() and to_mode2(), but a multilevel network has ties
within a mode, so the bipartite projection is invalid.
net_by_independence() had the same fault and was fixed by testing
is_multilevel() first and measuring the network whole, which needs no
projection.
Why this one is harder
That fix does not transfer. The two-mode branch here does not merely project —
it splits the result into "Mode 1" and "Mode 2" halves:
out <- c("Mode 1" = igraph::centr_eigen(manynet::as_igraph(manynet::to_mode1(.data)), ...),
"Mode 2" = igraph::centr_eigen(manynet::as_igraph(manynet::to_mode2(.data)), ...))
A multilevel network has no such halves to report, so the return shape has to
be decided before the branch can be written. Options worth weighing:
- measure the whole network and return one value, as
net_by_independence()
now does;
- keep two values but compute them on the within-mode subgraphs rather than on
projections;
- declare it unavailable for multilevel networks with
snet_unavailable().
Neither function is in an @examples block, so neither blocks
devtools::check().
net_by_eigenvector()andmode_by_eigenvector()both fail on a multilevelnetwork:
Both bundled multilevel datasets fail:
fict_marvelandfict_actually. Theyare the only two, and a sweep of every exported measure against both shows
these are the only remaining functions with this fault.
Cause
fict_marvelreportsis_twomode()TRUE,is_multilevel()TRUE. Theis_twomode()guards atR/measure_centrality_eigen.R:109, 173, 531
then reach
to_mode1()andto_mode2(), but a multilevel network has tieswithin a mode, so the bipartite projection is invalid.
net_by_independence()had the same fault and was fixed by testingis_multilevel()first and measuring the network whole, which needs noprojection.
Why this one is harder
That fix does not transfer. The two-mode branch here does not merely project —
it splits the result into
"Mode 1"and"Mode 2"halves:A multilevel network has no such halves to report, so the return shape has to
be decided before the branch can be written. Options worth weighing:
net_by_independence()now does;
projections;
snet_unavailable().Neither function is in an
@examplesblock, so neither blocksdevtools::check().