[R] Plotting minimum spanning tree in graph/RBGL

Wilson, Andrew eiaaw at exchange.lancs.ac.uk
Wed Apr 25 12:08:30 CEST 2007

I wonder if anyone could tell me how I can plot a Minimum Spanning Tree
using the functions provided in the "graph" and "RBGL" packages?

I am able to build the MST using the following set of commands:

> library(graph)

> library(RBGL)

> x <- read.table("h:/pole.tab",header=T,row.names=1)

> y <- dist(x)

> g1 <- new("distGraph",y)

> g2 <- mstree.kruskal(g1)

However, there doesn't seem to be a function that allows the command
"plot(g2)" to draw it.

Many thanks,

Andrew Wilson

More information about the R-help mailing list