mstree.kruskal {RBGL} | R Documentation |
compute the minimum spanning tree (MST) for a graph and return a representation in matrices
mstree.kruskal(x)
x |
instance of class graph |
calls to kruskal minimum spanning tree algorithm of Boost graph library
a list
edgeList |
a matrix m of dimension 2 by number of edges in the MST, with m[i,j] the jth node in edge i |
weights |
a vector of edge weights corresponding to the
columns of edgeList |
nodes |
the vector of nodes of the input graph x |
VJ Carey <stvjc@channing.harvard.edu>
km <- fromGXL(file(system.file("GXL/kmstEx.gxl",package="graph"), open="r")) mstree.kruskal(km) km@edgeL$B$weights <- c(1.1,.95) mstree.kruskal(km) km2 <- fromGXL(file(system.file("XML/telenet.gxl",package="RBGL"), open="r")) m <- mstree.kruskal(km2) print(sum(m[[2]]))