Learn R Programming

clustComp (version 1.0.0)

barycentre: Computation of the barycentre-coordinate of a node connected to others in a bigraph

Description

barycentre provides an updated coordinate value for a node that is connected to nodes in a different layer of a bigraph. It is computed as the average of coordinates of the adjacent nodes, where weighted edges are considered as multi-edges collapsed into one.

Usage

barycentre(edge.weight, coordinates = NULL)

Arguments

edge.weight
a vector containing the intersection sizes (edge weights) between a given node (from one of the partitionings) and all nodes in the other.
coordinates
a vector indicating the coordinates of the adjacent nodes. If it is not provided, then they are evenly spaced assuming a layout from top downwards.

Value

position
a nsumber indicating the barycentre-coordinate of the node under consideration.

Details

The node under consideration, from a given partitioning, is assigned a new position using the barycentre algorithm. The coordinates of the incident nodes are considered as many times as the corresponding edge weights indicate, and the new position for the node is given by the average over this set of coordinates.

References

Torrente, A. et al. (2005). A new algorithm for comparing and visualizing relationships between hierarchical and flat gene expression data clusterings. Bioinformatics, 21 (21), 3993-3999.

See Also

flatVSflat, flatVShier

Examples

Run this code
    # simulated data
    clustering1 <- c(rep(1, 5), rep(2, 10), rep(3, 10))
    clustering2 <- c(rep(1, 6), rep(2, 6), rep(3, 4), rep(4, 9))
    weights <- table(clustering1, clustering2)
    barycentre(weights[1, ], 1:4)
    barycentre(weights[1, ])
    barycentre(weights[2, ], 1:4)
    apply(weights, 1, barycentre, 1:4)

Run the code above in your browser using DataLab