igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Hops in graph


From: Gábor Csárdi
Subject: Re: [igraph] Hops in graph
Date: Wed, 7 Apr 2010 10:35:50 +0200

Surendar,

you mean you want to have row and columns names? Then do

colnames(g1) <- rownames(g1) <- V(g)$name
write.csv(g1, file=...)

Gabor

On Wed, Apr 7, 2010 at 2:25 AM, Surendar Swaminathan
<address@hidden> wrote:
> Hello Gabor,
>
>  Thank you.Yes I wrote into a csv file.Is there a way I can retain
> the original nodes I used.Like the way I use for
> betweenness,closeness. I have 7370 *7370 matrix and when I tried using
>
>  g2<-data.frame(Person=V(g)$name,g2=g1)
>
>
> Error: cannot allocate vector of size 58 Kb
> In addition: Warning messages:
> 1: In class(value) <- "data.frame" :
>  Reached total allocation of 1535Mb: see help(memory.size)
> 2: In class(value) <- "data.frame" :
>  Reached total allocation of 1535Mb: see help(memory.size)
>
> Help on this would be great.
>
> Surendar
>
>
>
>
> On Tue, Apr 6, 2010 at 1:43 AM, Gábor Csárdi <address@hidden> wrote:
>> Hello Surendar,
>>
>> On Mon, Apr 5, 2010 at 10:47 PM, Surendar Swaminathan
>> <address@hidden> wrote:
>>> Hello Graph experts,
>>>
>>>   I am trying to find number of hops between any two nodes for the
>>> whole graph.
>>> for example if I say
>>>
>>> Node1    Node2
>>>
>>> 1              2
>>> 2              3
>>> 3              4
>>>
>>> I want to say from "1" to "4" it has to pass through "2" and "3". So,
>>> total number of hops would be 2.
>>>
>>> Is there anyways I can do this in Igraph.
>>>
>>> tab<- read.csv("flie.csv")
>>> g<-graph.data.frame(tab,directed=False)
>>> g1<-shortest.paths(g)
>>
>> What is wrong with this code? (Except that 'False' should be 'FALSE'.)
>> The only difference between 'shortest.paths' and your definition is
>> that you need to subtract one from the 'shortest.paths' result.
>> 'shortest.paths' is counting the edges, and you're counting the nodes
>> along the path.
>>
>>> How do I output this in excel sheet to read them?
>>
>> Please see the 'write', 'write.table' and 'write.csv' functions. You
>> can import the CSV file into Excel directly.
>>
>> Best,
>> Gabor
>>
>>> What is the better way to output this result ?
>>> Help on this would be great.
>>>
>>> Thanks
>>> 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




reply via email to

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