igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] graph.data.frame & bipartite graphs


From: Yannick Rochat
Subject: [igraph] graph.data.frame & bipartite graphs
Date: Thu, 8 Oct 2009 16:02:59 +0200

Dear Gábor and Tamás,

I would like to use the command graph.data.frame to create a bipartite graph, but I can't find how to make it recognize two different sets of vertices (with different arguments, like actor$age, actor$gender and team$country, team$budget …).

Can graph.data.frame deal with bipartite graphs? If not, do I have to create a single data.frame with empty entries like the following one?


actors1 <- data.frame(name=c("Alice", "Bob", "Cecil"),age=c(48,33,45),country=NA) #Players
actors2 <- data.frame(name=c("Milan", "Zurich"),age=NA,country=c("Italy","Switzerland")) #Teams
relations <- data.frame(from=c("Alice","Alice","Bob","Cecil"),
                          to=c("Milan","Zurich","Milan","Zurich"))
actors <- rbind(actors1,actors2)
g <- graph.data.frame(relations, directed=TRUE, vertices=actors)
is.bipartite(g) #TRUE
print(g,v=TRUE)


Thanks in advance!

Best,


Yannick Rochat - IMA - Université de Lausanne
http://www.unil.ch/unisciences/YannickRochat

reply via email to

[Prev in Thread] Current Thread [Next in Thread]