Minimum spanning tree using Prim's algorithm
primDistance(distMatrix)
A square matrix containing the distances between all vertexes of a network
A matrix with rows describing which vertex is connected to which other vertex.
# NOT RUN {
distMatrix <- matrix(c(0,10,20,30,10,0,40,60,20,40,0,30,30,60,30,0),
nrow = 4, ncol = 4, byrow = TRUE)
primDistance(distMatrix)
# }
Run the code above in your browser using DataLab