igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] weighted pagerank?


From: Csardi Gabor
Subject: Re: [igraph] weighted pagerank?
Date: Sat, 23 Aug 2008 22:24:10 +0200
User-agent: Mutt/1.5.9i

Please see http://lists.gnu.org/archive/html/igraph-help/2008-08/msg00028.html
You might miss the answers to your questions if you're not on the 
mailing list.

G.

On Sat, Aug 23, 2008 at 12:39:34PM -0400, Eytan Bakshy wrote:
> Hi Csardi,
> 
> My bad, perhaps this is an issue with only the python version and not  
> the R version.
> 
> Here are two python versions of the test example you gave in R:
> 
>       from igraph import *
>       import random
>       g = Graph.Barabasi(1000,m=5).simplify()
>       pg1 = g.pagerank()
>       pg2 = g.pagerank(weights=[random.randint(1,1000) for i in  
> xrange(g.ecount())])
>       max([(i-j)/i for i,j in zip(*(pg1,pg2))])
> 
> yields 0.0.  also, if i compare pg1 and pg2 directly (pg1 == pg2), the  
> two vectors identical
> 
> I alternatively tried assigning the weights to edge attributes:
>       for e in g.es: e['weight'] = random.randint(1,1000)
>       pg2 = g.pagerank(weights='weight')
> and got the same result,
> 
> Is there something I am doing incorrectly in specifying the edge  
> weights in python?
> 
> Thanks,
> 
> -e
> 
> 
> On Aug 23, 2008, at 10:02 AM, Csardi Gabor wrote:
> 
> >Eytan,
> >
> >the difference is more than 50 percent. I guess it would be more
> >if the weights were not uniformly distributed.
> >
> >>library(igraph)
> >>g <- simplify(ba.game(1000, m=5))
> >>pg1 <- page.rank(g)
> >>pg2 <- page.rank(g, weights=runif(ecount(g),1,1000))
> >>max( (pg1$vector - pg2$vector) / pg1$vector)
> >[1] 0.5442513
> >
> >Gabor
> >
> >On Fri, Aug 22, 2008 at 07:18:30PM -0400, Eytan Bakshy wrote:
> >>Hello,
> >>
> >>I am using igraph 0.51 in R and igraph 0.5 in python, and it doesn't
> >>seem that specifying edge weights has any effect in either
> >>implementation.  I know that the igraph 0.5 release announcement
> >>mentions that Page Rank and the fast greedy algorithm supports edge
> >>weights, but is this just in the C library.
> >>
> >>In python, I tried creating several graphs where edges have the
> >>attribute 'weight', which were floats.  I am trying to compute the
> >>weighted pagerank by saying:
> >>    prw = g.pagerank(weights='weight')
> >>
> >>and if i do:
> >>    pr = g.pagerank()
> >>the following statement yields True:
> >>    prw == pr
> >>
> >>on several graphs using edge weights that were distributed uniformly
> >>at random between (0,1), and then again between (1,1000)
> >>
> >>
> >>I am pretty new to R, but it appears that the same thing holds using
> >>page.rank(g, weights=runif(length(E(g)),1,10000))
> >>
> >>
> >>Thanks,
> >>Eytan
> >>
> >>
> >>_______________________________________________
> >>igraph-help mailing list
> >>address@hidden
> >>http://lists.nongnu.org/mailman/listinfo/igraph-help
> >
> >-- 
> >Csardi Gabor <address@hidden>    MTA RMKI, ELTE TTK
> 

-- 
Csardi Gabor <address@hidden>    MTA RMKI, ELTE TTK




reply via email to

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