Convert igraph to population
from_igraph(x, ...)
igraph, must be a forest of directed trees with unique positive integer names (as they will be pid's)
Ignored
A population
g <- igraph::graph_from_literal( 2 +- 1 -+ 3, 4 -+ 5 )
plot(g)
pop <- from_igraph(g)
peds <- build_pedigrees(pop, progress = FALSE)
plot(peds)
infer_generations(peds)
get_generation(get_individual(pop, 1))
#> [1] 1
get_generation(get_individual(pop, 2))
#> [1] 0
get_generation(get_individual(pop, 3))
#> [1] 0
get_generation(get_individual(pop, 4))
#> [1] 1
get_generation(get_individual(pop, 5))
#> [1] 0