[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Giant Component
From: |
Surendar Swaminathan |
Subject: |
Re: [igraph] Giant Component |
Date: |
Wed, 19 Aug 2009 15:44:28 -0700 |
Hello Gabor,
Thank for the reply. I could not get this to work. when I do
get.edgelist(g2,names=TRUE)
it throws saying g2 is not a graph object.
I went throgh Igraph
get.edgelist (graph,names=TRUE)
What should I do.
This is what I tried
tab<-read.csv("file")
g<-graph.data.frame(tab,directed=FALSE)
V(g)$name <- seq_len(vcount(g))-1
giant.component <- function(graph) {
cl <- clusters(graph)
subgraph(graph, which(cl$membership == which.max(cl$csize)-1)-1)
}
g2<-giant.component(g)
get.edgelist(g2,names=TRUE)
throws an error saying g2 is not a graph object.
Thank you
Surendar
On Wed, Aug 19, 2009 at 11:45 AM, Gábor Csárdi<address@hidden> wrote:
> Hello,
>
> add a vertex attribute for the original graph:
>
> V(g)$name <- seq_len(vcount(g))-1
>
> and then you can query the edgelist using the 'name' vertex attribute:
>
> g2 <- giant.component(g)
> get.edgelist(g2, names=TRUE)
>
> Best,
> Gabor
>
> On Wed, Aug 19, 2009 at 8:39 PM, Surendar
> Swaminathan<address@hidden> wrote:
>> Hello Gabor,
>>
>> Thank you very much for the reply. Its working perfectly thank you
>> very much. I am trying to output the edgeliest with Vertex number.
>>
>> I want to output the original vertex number that I used for the input.
>>
>> I tried doing write.graph(giant,"file name","edgelist")
>> this writex the output, but it starts with zero.And, also tried
>> graph.data.frame it does not allow me to do it.
>>
>> Earlier I used to find bet<-between(g)
>> bet<-data.frame(Person=V(g)$name,bet=betweenness)
>>
>> is there anyway I can do something like this.
>>
>> Thank you very much once again.
>>
>> Surendar
>>
>> On Tue, Aug 18, 2009 at 12:37 AM, Gábor Csárdi<address@hidden> wrote:
>>> Surendar,
>>>
>>> what is the tail component? Everything else than the largest? Then
>>> these will do:
>>>
>>> giant.component <- function(graph, ...) {
>>> cl <- clusters(graph, ...)
>>> subgraph(graph, which(cl$membership == which.max(cl$csize)-1)-1)
>>> }
>>>
>>> tail.component <- function(graph, ...) {
>>> cl <- clusters(graph, ...)
>>> subgraph(graph, which(cl$membership != which.max(cl$csize)-1)-1)
>>> }
>>>
>>> Gabor
>>>
>>> On Tue, Aug 18, 2009 at 12:08 AM, Surendar
>>> Swaminathan<address@hidden> wrote:
>>>> Hello All,
>>>>
>>>> I have been doing SNA metrics using Igraph in R. I have this
>>>> question. What I have is node to node link. Is there anyway I can find
>>>> Giant and Tail component.
>>>>
>>>> Surendar
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>
>>
>> _______________________________________________
>> 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
>