Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

locationgamer (version 0.1.0)

primDistance: Minimum spanning tree using Prim's algorithm

Description

Minimum spanning tree using Prim's algorithm

Usage

primDistance(distMatrix)

Arguments

distMatrix

A square matrix containing the distances between all vertexes of a network

Value

A matrix with rows describing which vertex is connected to which other vertex.

Examples

Run this code
# 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