[Top][All Lists]

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

Re: [igraph] two-mode network in igraph

From: Simone Gabbriellini
Subject: Re: [igraph] two-mode network in igraph
Date: Fri, 24 Sep 2010 15:28:59 +0200


this is a much more simpler way! thanks a lot!

and all I have to do is something like:

V(g)$type<-ifelse(grep("thread",V(g)$name)==1, FALSE, TRUE)

to set the type attribute... I know that code doesn't work, still have to find 
a way, but I got the point


Il giorno 24/set/2010, alle ore 14.38, Tamas Nepusz ha scritto:

>> 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
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

reply via email to

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