1

ランダム グラフを生成するこのコードがあります。グラフ内のブリッジとカットを識別するにはどうすればよいですか

library(igraph)
G <- graph( c(1,2,1,3,1,4,3,4,3,5,5,6,6,7,7,8,8,9,3,8,5,8,10,1,10,2,11,2,12,1,13,4,13,7,14,2,15,6,16,7,17,8,19,13,18,4,19,7), directed = FALSE )
# Assign attributes to the graph
G$name    <- "A colorful example graph"
# Assign attributes to the graph's vertices
V(G)$name  <- toupper(letters[1:20])
V(G)$color <- sample(rainbow(20),20,replace=FALSE)
# Assign attributes to the edges
E(G)$weight <- runif(length(E(G)),.3,2)
# Plot the graph -- details in the "Drawing graphs" section of the igraph manual
plot(G, layout = layout.fruchterman.reingold, 
     main = G$name,
     vertex.label = V(G)$name,
     vertex.size = 15,
     vertex.color= V(G)$color,
     vertex.frame.color= "white",
     vertex.label.color = "white",
     vertex.label.family = "sans",
     edge.width=E(G)$weight, 
     edge.color="black")
4

2 に答える 2

1

実装されていないようです。hereで説明されているように、スパニング ツリーを見つける関数から始めて、Trajan のアルゴリズムを実装できます。

minimum.spanning.tree

カットに関しては、同じソースがあなたのものとは異なる定義を指していますが、チェックアウトすることをお勧めします.

于 2015-05-10T06:10:48.523 に答える