Skip to content

net_by_eigenvector() and mode_by_eigenvector() error on multilevel networks #23

Description

@jhollway

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().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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