igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Neighbor vertices List


From: Gábor Csárdi
Subject: Re: [igraph] Neighbor vertices List
Date: Wed, 14 Oct 2009 14:13:59 +0200

Surendar,

I would not say I understand completely your question, but maybe you
want to use symbolic vertex names, e.g. create your graph with
graph.data.frame(). Then translate your 700 pairs to igraph vertex
ids, like this, assuming they are in 'pairs' and 'g' is your graph
with vertex names:

pairs2 <- structure(match(pairs, V(g)$name), dim=dim(pairs))

And then run get.shortest.paths() for each pair:

paths <- apply(pairs2, 1, function(x) get.shortest.paths(g, from=x[1], to=x[2]))

Is this what you want?

G.

On Thu, Oct 8, 2009 at 1:44 AM, Surendar Swaminathan
<address@hidden> wrote:
> Hello Gabor,
>
> I have around 20,000 nodes weighted undirected graph. I have around
> 700 pair of nodes that I need to find the nodes it traverses through
> in 20,000 nodes graph.
>
> Once I create graph object using Igraph. Igraph starts from Node 1 is
> there anyway I can input the graph node(say 2344445)  and I want to
> find corresponding node created by Igraph.
>
> I have 700 pairs of nodes and I do want to find the nodes it traverses
> through using get.shortest.paths
>
> I have them in a seperate excel file is there anyway I can do this.
>
> Help on this would be great.
>
> Thank you once again.
>
> On Fri, Oct 2, 2009 at 2:35 PM, Surendar Swaminathan
> <address@hidden> wrote:
>> Hello Gabor,
>>
>>  Got it work. Thank you very much for the reply.  What I am trying to
>> do is I have a list of vertices and I want to find the node it
>> traverse through from one node to another node.
>>
>> I have around 20,000 nodes weighted undirected graph. I have around
>> 700 pair of nodes that I need to find the nodes it traverses through
>> in 20,000 nodes graph.
>>
>> I have them in a seperate excel file is there anyway I can do this.
>>
>> Help on this would be great.
>>
>> Thank you once again.
>>
>> Surendar
>>
>> On Tue, Sep 29, 2009 at 1:01 PM, Gábor Csárdi <address@hidden> wrote:
>>> On Tue, Sep 29, 2009 at 8:15 PM, Surendar Swaminathan
>>> <address@hidden> wrote:
>>>> Hello Gabor,
>>>>
>>>>  Thank you very much for the reply. This is what I tried and  it says
>>>>
>>>> At iterators.c:721 : Cannot create iterator, invalid vertex id,
>>>> Invalid vertex id
>>>>
>>>> I am trying for a small example
>>>>
>>>> What I have is undirected graph.
>>>>
>>>> Node1                 Node2
>>>> 2                           1
>>>> 1                           3
>>>> 3                           5
>>>>
>>>> library(igraph)
>>>> tab<-read.csv("file path\name.csv')
>>>> g<-graph.data.frame(tab,directed=FALSE)
>>>> get.shortest.paths(g,2,5,mode=c("all"),weights=NULL)
>>>
>>> There are only four vertices in your graph: "1", "2", "3" and "5".
>>> graph.data.frame() uses symbolic vertex names, and
>>> get.shortest.paths() uses numeric vertex IDS, starting from zero.
>>>
>>> Best,
>>> Gabor
>>>
>>>>  At iterators.c:721 : Cannot create iterator, invalid vertex id,
>>>> Invalid vertex id
>>>>
>>>> can you please help me with regard to this .Am I making any mistake
>>>>
>>>> Thank you very much for helping.
>>>>
>>>> Surendar
>>>>
>>>>
>>>>
>>>> On Mon, Sep 28, 2009 at 11:42 PM, Gábor Csárdi <address@hidden> wrote:
>>>>> I think what you are looking for is probably the get.shortest.paths()
>>>>> or the get.all.shortest.paths() functions.
>>>>> Best,
>>>>> Gabor
>>>>>
>>>>> On Tue, Sep 29, 2009 at 12:12 AM, Surendar Swaminathan
>>>>> <address@hidden> wrote:
>>>>>>  Is there a way I can list the nodes traversed from one node to the
>>>>>> other nodes.
>>>>>>
>>>>>> Give a graph object. If I have a source node and Target node can I
>>>>>> find a way to list all the nodes to reach from source node to target
>>>>>> node.
>>>>>>
>>>>>>
>>>>>> Example
>>>>>>
>>>>>> Node vv1            Node v2
>>>>>>
>>>>>> 1                          2
>>>>>> 2                          3
>>>>>> 3                          4
>>>>>>
>>>>>> when Input node 1,node 4 I want the output to list 2,3.
>>>>>>
>>>>>>
>>>>>> Thank you very much for the help,
>>>>>>
>>>>>> 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
>>>
>>
>
>
> _______________________________________________
> 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]