【发布时间】:2014-04-09 19:59:28
【问题描述】:
我尝试从名为 routes$Source Airport 和 routes$Destination Airport 的数据框列制作 igraph
我输入
g<-graph.formula("routes$Source Airport","routes$Destination Airport")
plot.igraph(g)
我不确定这是否正确!!!
【问题讨论】:
我尝试从名为 routes$Source Airport 和 routes$Destination Airport 的数据框列制作 igraph
我输入
g<-graph.formula("routes$Source Airport","routes$Destination Airport")
plot.igraph(g)
我不确定这是否正确!!!
【问题讨论】:
在变量名称中包含空格是个坏主意。让我们使用source 和dest 代替我们的变量名:
dat <- data.frame(source=1:3, dest=c(3, 1, 1))
您可以使用graph.data.frame 函数制作和绘制图表:
g <- graph.data.frame(dat)
plot(g)
【讨论】: