mstree {ade4}R Documentation

Minimal Spanning Tree

Description

Minimal Spanning Tree

Usage

mstree(xdist, ngmax = 1)

Arguments

xdist an object of class dist containing an observed dissimilarity
ngmax a 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

Author(s)

Daniel Chessel

Examples

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)
 }

Worked out examples


> library(ade4)
> ### Name: mstree
> ### Title: Minimal Spanning Tree
> ### Aliases: mstree
> ### Keywords: utilities
> 
> ### ** Examples
> 
> 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)
+  }
> 
> 
> 
> 

[Package ade4 Index]