I expect igraph::count_multiple() to count edge multiplicity, which the documentation seems to reflect. However, it doesn't always result in whole numbers.
An example:
library(igraph)
library(dplyr)
data("USairports", package = "igraphdata")
Expectation: Counting edges, while grouping on relevant vertices...
(
manualish_count <- USairports %>%
igraph::as_data_frame() %>%
add_count(from, to)
) %>%
select(from, to, n)
#> # A tibble: 23,473 x 3
#> from to n
#> <chr> <chr> <int>
#> 1 BGR JFK 2
#> 2 BGR JFK 2
#> 3 BOS EWR 10
#> 4 ANC JFK 1
#> 5 JFK ANC 1
#> 6 LAS LAX 20
#> 7 MIA JFK 10
#> 8 EWR ANC 1
#> 9 BJC MIA 1
#> 10 MIA BJC 1
#> # ... with 23,463 more rows
... results in whole numbers; manualish_count$n contains <int>egers.
Using igraph, everything seems fine at first glance...
(ig_count <- count_multiple(USairports)) %>% head(10)
#> [1] 2 2 10 1 1 20 10 1 1 1
... but there are actually fractions:
ig_count[ig_count %% 1 != 0]
#> [1] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 1.5 1.5 1.5 1.5 0.5 1.5 1.5 0.5 0.5 0.5
#> [18] 0.5 1.5 1.5 1.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5
#> [35] 0.5
Am I misunderstanding count_multiple()'s purpose or using it incorrectly?
igraph_version()
#> [1] "1.2.2"