generates new graphs from basegraph as follows:
generates all possible trees using addpops (which are not in basegraph)
attaches trees to connection_edge, which is defined by two nodes in basegraph
adds edges originating above each edge in source_node, to each node above addpops
graphmod_pavel(basegraph, addpops, connection_edge, source_nodes)an admixture graph as igraph object. (convert from edge list using igraph::graph_from_edgelist)
a vector of population labels which are not in basegraph. These populations should form a clade. All possible trees will be generated and those trees will be attached to basegraph.
edge in basegraph where the tree made from addpops should be attached
nodes in basegraph. edges above these nodes will be added and attached to all terminal edges leading to addpops
if (FALSE) {
graphlist = graphmod_pavel(example_igraph, addpops = c('pop1', 'pop2', 'pop3'),
connection_edge = c('N2N0', 'N1N'),
source_nodes = c('Denisova.DG', 'N2N2'))
results = tibble(graph = graphlist) %>%
mutate(res = map(graph, ~qpgraph(example_f2_blocks, .))) %>%
unnest_wider(res) %>%
mutate(worstz = map_dbl(f3, ~max(abs(.$z))))
}