문제

I try to make an igraph from dataframe columns called routes$Source Airport and routes$Destination Airport I type in

g<-graph.formula("routes$Source Airport","routes$Destination Airport")
plot.igraph(g)

I'm not sure that is correct!!!

도움이 되었습니까?

해결책

It's a bad idea to have spaces in the names of your variables. Let's just use source and dest instead for our variable names:

dat <- data.frame(source=1:3, dest=c(3, 1, 1))

You can make and plot your graph with the graph.data.frame function:

g <- graph.data.frame(dat)
plot(g)

graph

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top