Learn R Programming

ade4 (version 1.2-2)

mstree: Minimal Spanning Tree

Description

Minimal Spanning Tree

Usage

mstree(xdist, ngmax = 1)

Arguments

xdist
an object of class dist containing an observed dissimilarity
ngmax
Component number (default=1). Select 1 for getting classical MST. To add n supplementary edges k times: select k+1.

Value

  • returns an object of class neig

Examples

Run this code
data(mafragh)
maf.coa = dudi.coa(mafragh$flo, scan = FALSE)
maf.mst = mstree(dist.dudi(maf.coa), 1)
s.label(maf.coa$li, clab = 0, cpoi = 2, neig = maf.mst, cnei = 1)

xy = data.frame(x = runif(20), y = runif(20))
par(mfrow = c(2,2))
for (k in 1:4) {
    neig = mstree (dist.quant(xy,1), k)
    s.label(xy, xlim = c(0,1), ylim = c(0,1), addax = FALSE, neig = neig)
 }

Run the code above in your browser using DataLab