[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:39:36 +0200 |
done, it works poerfectly, thanks a lot!
simone
Il giorno 24/set/2010, alle ore 15.31, Gábor Csárdi ha scritto:
> On Fri, Sep 24, 2010 at 3:28 PM, Simone Gabbriellini
> <address@hidden> wrote:
>> Tamas,
>>
>> 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)
>
> Use 'grepl' instead of 'grep', that returns a logical vector and you
> don't even need the 'ifelse'.
>
> G.
>
>> to set the type attribute... I know that code doesn't work, still have to
>> find a way, but I got the point
>>
>> thanks,
>> simone
>>
>> 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
>>
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>
>
>
> --
> Gabor Csardi <address@hidden> UNIL DGM
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
- Re: [igraph] two-mode network in igraph, (continued)
- Re: [igraph] two-mode network in igraph, Simone Gabbriellini, 2010/09/23
- Re: [igraph] two-mode network in igraph, Simone Gabbriellini, 2010/09/24
- Re: [igraph] two-mode network in igraph, Simone Gabbriellini, 2010/09/24
- Re: [igraph] two-mode network in igraph, Tamas Nepusz, 2010/09/24
- Re: [igraph] two-mode network in igraph, Simone Gabbriellini, 2010/09/24
- Re: [igraph] two-mode network in igraph, Tamas Nepusz, 2010/09/24
- Re: [igraph] two-mode network in igraph, Simone Gabbriellini, 2010/09/24
- Re: [igraph] two-mode network in igraph, Tamas Nepusz, 2010/09/24
- Re: [igraph] two-mode network in igraph, Simone Gabbriellini, 2010/09/24
- Re: [igraph] two-mode network in igraph, Gábor Csárdi, 2010/09/24
- Re: [igraph] two-mode network in igraph,
Simone Gabbriellini <=
- Re: [igraph] two-mode network in igraph, Tamas Nepusz, 2010/09/23