igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] connected graph returns shortest.paths with inf


From: Martin Tomko
Subject: Re: [igraph] connected graph returns shortest.paths with inf
Date: Wed, 01 Sep 2010 11:26:59 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100227 Lightning/1.0b1 Thunderbird/3.0.3

Thanks Tamas, will do some more testing here and will email you if the problem persists. I have tried testing with a different graph now (which is definitely connected), and it seems to work. The problem I had was after reading in a disconnected graph and running (in igraph 0.5.2-2, R 2.9.2, Win XP):

if(is.connected(g)==FALSE){
        c <- clusters(g)
        g <- subgraph(g,which(c$membership==which.max(c$csize)-1)-1);
    }

Anyway, will test more and get back to you.
Martin

On 9/1/2010 11:14 AM, Tamas Nepusz wrote:
Dear Martin,

nodes<- V(g);
y<-lapply(nodes,function(x){shortest.paths(g,x)})

max(y[[1]]) returns Inf, and also sum(y[[1]]==Inf), meaning that
there are disconnected nodes.

How could that happen?
First I was thinking that is.connected() in R may be checking for strong
connectedness and your graph may be only weakly connected (meaning that
there is a path from A to B but no path from B to A); however, it turns
out not to be the case (at least not in 0.6). I'm not that familiar with
the R interface, but if you can send me a small(ish) example graph on
which I could reproduce the problem, I'll take a look.

Cheers,
Tamas




--
Martin Tomko
Postdoctoral Research Assistant

Geographic Information Systems Division
Department of Geography
University of Zurich - Irchel
Winterthurerstr. 190
CH-8057 Zurich, Switzerland

email:  address@hidden
site:   http://www.geo.uzh.ch/~mtomko
mob:    +41-788 629 558
tel:    +41-44-6355256
fax:    +41-44-6356848




reply via email to

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