igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] RES: RES: Egonetworks in Igraph


From: Gábor Csárdi
Subject: Re: [igraph] RES: RES: Egonetworks in Igraph
Date: Thu, 15 Sep 2011 08:55:20 -0400

On Thu, Sep 15, 2011 at 8:37 AM, Carlos Eduardo <address@hidden> wrote:
> a) This worked ok: data.frame(ID=as.vector(V(g)), name=V(g)$name).
>
> b) This didn't work: graph.neighborhood(g, 1, "BRA"). I also tried without
> quotation marks graph.neighborhood(g, 1, BRA). The R outputs:
> graph.neighborhood(g, 1, "BRA") => Error : Invalid vertex names

You apparently have no vertex called "BRA", or you are using an old
version of igraph. It works fine otherwise:

> g <- graph.ring(10)
> V(g)$name <- letters[1:10]
> graph.neighborhood(g, 1, "a")
[[1]]
Vertices: 3
Edges: 2
Directed: FALSE
Edges:

[0] 'a' -- 'b'
[1] 'a' -- 'j'

> graph.neighborhood(g, 1, BRA) => Error : objecto 'ARG' didn't found

This is wrong. String literals must be quoted in R.

> c) How to change the class of the "graph.neighborhood" outpud (class=list)
> to an Igraph class object? Is that possible?

I don't get this. How would you convert a list of graphs to a graph?
And why? Don't you just want to take the first (and only) graph from
the list? E.g.:

graph.neighborhood(g, 1, "BRA")[[1]]

G.

> Thanks,
> Cadu
>
>
>
> -----Mensagem original-----
> De: address@hidden
> [mailto:address@hidden Em nome de Gábor
> Csárdi
> Enviada em: quarta-feira, 14 de setembro de 2011 17:04
> Para: Help for igraph users
> Assunto: Re: [igraph] RES: Egonetworks in Igraph
>
> On Wed, Sep 14, 2011 at 3:36 PM, Carlos Eduardo <address@hidden> wrote:
>> Thanks! It worked! Anyway, a couple of questions appeared:
>>
>> I executed the follow command: h<-graph.neighborhood(g,1,1). But class(h)
>> shows that h is a "list". Is there any way to:
>
> It is a list of igraph objects. You can supply many egos, and then get
> a list of ego networks. If you just have one ego, then h[[1]] will
> give you that ego network.
>
>> a.1) change h to a "igraph" object?
>>
>> a.2) insert h (list) as a attribute of g (igraph), bearing in mind to
>> identify visually (e.g. through Visone software) the egonetwork as a part
> of
>> the bigger network?
>>
>> b) I'd prefer to use the vertex identification (e.g. $name) rather than
> the
>> vertex number. Is there any way to show a correspondence list between
> vertex
>> number and other attribute (e.g. $name). Some output like this:
>
> E.g.
>
> data.frame(ID=as.vector(V(g)), name=V(g)$name)
>
> You can actually give the vertex names instead of vertex ids:
>
> graph.neighborhood(g, 1, "BRA")
>
> Gabor
>
>> 1-BRA
>> 2-ARG
>> 3-KOR
>> 4-CHI
>> 5-EUN
>> 6-RUS
>>
>> Thanks in advance,
>> Cadu
>>
>>
>> -----Mensagem original-----
>> De: address@hidden
>> [mailto:address@hidden Em nome de
> Gábor
>> Csárdi
>> Enviada em: quarta-feira, 14 de setembro de 2011 13:13
>> Para: Help for igraph users
>> Assunto: Re: [igraph] Egonetworks in Igraph
>>
>> On Wed, Sep 14, 2011 at 12:10 PM, Carlos Eduardo <address@hidden>
>> wrote:
>> [...]
>>> The question: Is there any command to pick up egonetworks inside a large
>>> network?
>>
>> Use graph.neighborhood(), and give order=1, and nodes=<your ego>.
>>
>> Gabor
>>
>> [...]
>> --
>> Gabor Csardi <address@hidden>     MTA KFKI RMKI
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>
>
>
> --
> Gabor Csardi <address@hidden>     MTA KFKI RMKI
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     MTA KFKI RMKI



reply via email to

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