igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] two-mode network in igraph


From: Tamas Nepusz
Subject: Re: [igraph] two-mode network in igraph
Date: Fri, 24 Sep 2010 13:38:25 +0100

> do I have to put in the type vector one element of the first kind, one of the 
> second kind, one of the first... etc???
Nope. The type vector must have N elements if you have N vertices, and the i-th 
element must be 0 if vertex i is of the first type, or 1 if vertex i is of the 
second type.

> is there no way to let igraph knows about the actual names of the vertex?
You can use vertex attributes, but only after you have created the graph with 
numeric vertex IDs. igraph does not allow arbitrary objects or strings as 
vertex identifiers, only numbers.

On the other hand, note that bipartite graphs are not special in any way in 
igraph, so you can create a "regular" graph first using any other methods 
(e.g., read from an NCOL file that allows vertex names, or use graph.formula). 
The only distinguishing feature for bipartite and non-bipartite graphs is the 
"type" vertex attribute, but you can assign that later!

For instance, suppose this is your original graph:

author1 thread1
author2 thread1
author1 thread2
author3 thread2
author3 thread3

Load this as an NCOL file, then go through the vertex names and create a 0-1 
type vector using the names (e.g., if the name starts with "author", then it is 
of type 0, if the name starts with "thread", then it is of type 1). Finally, 
assign the type vector to the "type" attribute (V(g)$type <- types) and you're 
ready.

-- 
Tamas




reply via email to

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