Network manipulation

The package contains many utilities to extract information about phylogenetic networks, and to modify networks. Functions that are not exported are more likely to experience breaking changes in future versions, but can be used by prefixing their name with PhyloNetworks. .

Below is a list of the most useful functions. They typically assume a bicombining network, that is, a network in which each hybrid node has exactly 2 parents (never more).

Getting information on a network

overall network information

  • tiplabels for taxon labels
  • getroot gives the root node
  • pairwisetaxondistancematrix for average distances
  • vcv for the variance-covariance matrix between taxa under a Brownian Motion model along the network, and sharedpathmatrix for the variance-covariance between all nodes (not just leaves)
  • istimeconsistent: true or false, to know if for all nodes, the various paths from the root to that node have the same length (as expected if length was proportional to time)
  • getnodeages assuming the network is time-consistent and ultrametric
  • displayedtrees or majortree to get the displayed trees or major tree, respectively
  • hardwiredclusters to get all clusters of taxa on a network
  • checkroot! to check that the graph is a valid semidirected network with a root node in a admissible rooting position

on the network complexity:

The following functions all compute distances from the root to each node. Their differ in how they handle time inconsistency: when the distance from the root to a node varies across multiple paths from the root to that node.

node information

To learn about nodes and how some might be related or connected, one can use:

To learn about the edges connected to a given node, one can use:

edge information

To learn about the nodes related connected to a given edge, one can use the following functions:

Modifying a network

To modify some of the core components of a network:

To remove components from a network:

To add components to a network:

To modify some internal attributes, that don't affect the network topology or edge parameters:

To calibrate a network (modify its edge lengths):

Comparing two networks

  • hardwiredclusterdistance: extends the Robinson-Foulds distance. It's a dissimilarity measure on networks: a dissimilarity of 0 does not guarantee that the 2 networks have the same topology in general. But it does if the networks are in some classes (e.g. trees, level-1, tree-child, and others).