Just following up on yesterday. I wrote a small function that can delete hybridizations that cause the outgroup to be below a hybridization node. This
should allow you to root at the specified outgroup if you want to discard hybridizations that have the outgroup as a descendant. See the example below:
```
using PhyloNetworks
function remove_outgroupreticulations!(net,outgroup)
preorder!(net)
nd_ind = findfirst(x->
x.name==outgroup,net.vec_node)
desc_mat = descendencematrix(net;checkpreorder=false).V
nd_ancs = net.vec_node[desc_mat[nd_ind,:] .> 0.0] #nodes that are ancestor to our outgroup
hyb_ancs = filter(x->x.hybrid,nd_ancs) #ancestors of outgroup that are hybrids
for hyb_nd in hyb_ancs
hyb_edge = getparentedgeminor(hyb_nd) #the minor edge to delete
PhyloNetworks.deletehybridedge!(net,hyb_edge)
end
end
net = readnewick("(C,D,((O,(E,#H7:::0.196):0.314):0.664,(((A1,A2))#H7:::0.804,B):10.0):10.0);")
rootatnode!(net,"A1") ##gives RootMismatch error because of H7
remove_outgroupreticulations!(net,"A1")
net #no more reticulation that leads to A1
rootatnode!(net,"A1") #success