[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Shortest path matrix
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] Shortest path matrix |
Date: |
Mon, 6 Jul 2015 11:05:34 +0200 |
It is in igraph 1.0.0. If you want sg that works with older versions
as well, then you can use the 'name' vertex attribute. E.g.
library(igraph)
g <- graph.ring(10)
V(g)$name <- LETTERS[1:10]
sp <- get.shortest.paths(g, 'A', 'B')
V(g)[ sp$vpath[[1]] ]$name
This probably works with version 0.7.x as well, but I haven't actually
tried, sorry.
Gabor
On Mon, Jul 6, 2015 at 9:38 AM, seema aswani <address@hidden> wrote:
> Can you give any examle..??
>
> On Mon, Jul 6, 2015 at 1:04 PM, seema aswani <address@hidden> wrote:
>>
>> Hi ,
>> Thank you for you reply.
>> Is this `as_ids` is inbuilt function in r?? I didn't found any..
>>
>> On Mon, Jul 6, 2015 at 12:49 PM, Gábor Csárdi <address@hidden>
>> wrote:
>>>
>>> "You can convert an igraph.vs to vertex names with `as_ids`, and
>>> vertex ids with `as.vector`."
>>>
>>> Gabor
>>>
>>> On Mon, Jul 6, 2015 at 9:10 AM, seema aswani <address@hidden>
>>> wrote:
>>> > Hi all,
>>> >
>>> > I want the matrix not with numbers but with the vertex names as protein
>>> > names. I already got the result of pair wise shortest path with its
>>> > vertex
>>> > names.
>>> > its class is igraph.vs. Is there any way to convert igraph.vs class in
>>> > to
>>> > matrix..??
>>> > a matrix like
>>> >
>>> > [,1] [,2]
>>> > [1,] "trpA" "tprB" "trpC" trpD"
>>> >
>>> > That shows as result
>>> >
>>> > [,1] [,2]
>>> > [1,] String,2 String,2
>>> >
>>> > Thanks.
>>> >
>>> >
>>> >
>>> > On Sun, Jul 5, 2015 at 8:16 PM, seema aswani <address@hidden>
>>> > wrote:
>>> >>
>>> >> Hi Gabor,
>>> >> Thanks a lot for your response..:) It really helps alot.
>>> >>
>>> >> On Sun, Jul 5, 2015 at 7:59 PM, Gábor Csárdi <address@hidden>
>>> >> wrote:
>>> >>>
>>> >>> On Sun, Jul 5, 2015 at 4:18 PM, seema aswani <address@hidden>
>>> >>> wrote:
>>> >>>>
>>> >>>> Hi,
>>> >>>> Just tried the way you told. But it is giving the resultant matrix
>>> >>>> in
>>> >>>> form of
>>> >>>> [,1] [,2]
>>> >>>> [1,] Integer,3 Integer,3
>>> >>>> [2,] Integer,3 Integer,3 in your example. This is not giving the
>>> >>>> result
>>> >>>> as 1 2 3 1 2 3 3 2 1 3 2 1 as this.
>>> >>>
>>> >>>
>>> >>> Yes, you need to index the matrix to see the actual result. Lists can
>>> >>> contain pretty much any R object, so when your matrix has lists as
>>> >>> cells, R
>>> >>> cannot really print the contents, there is no guarantee that it would
>>> >>> even
>>> >>> fit to the screen.
>>> >>>
>>> >>> G.
>>> >>>
>>> >>> _______________________________________________
>>> >>> igraph-help mailing list
>>> >>> address@hidden
>>> >>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>> >>>
>>> >>
>>> >
>>> >
>>> > _______________________________________________
>>> > igraph-help mailing list
>>> > address@hidden
>>> > https://lists.nongnu.org/mailman/listinfo/igraph-help
>>> >
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
- Re: [igraph] Shortest path matrix, (continued)
- Re: [igraph] Shortest path matrix, Gábor Csárdi, 2015/07/05
- Re: [igraph] Shortest path matrix, seema aswani, 2015/07/05
- Re: [igraph] Shortest path matrix, Gábor Csárdi, 2015/07/05
- Re: [igraph] Shortest path matrix, seema aswani, 2015/07/05
- Re: [igraph] Shortest path matrix, Gábor Csárdi, 2015/07/05
- Re: [igraph] Shortest path matrix, seema aswani, 2015/07/05
- Re: [igraph] Shortest path matrix, seema aswani, 2015/07/06
- Re: [igraph] Shortest path matrix, Gábor Csárdi, 2015/07/06
- Re: [igraph] Shortest path matrix, seema aswani, 2015/07/06
- Re: [igraph] Shortest path matrix, seema aswani, 2015/07/06
- Re: [igraph] Shortest path matrix,
Gábor Csárdi <=
- Re: [igraph] Shortest path matrix, seema aswani, 2015/07/07
- Re: [igraph] Shortest path matrix, Gábor Csárdi, 2015/07/07
- Re: [igraph] Shortest path matrix, seema aswani, 2015/07/07
- Re: [igraph] Shortest path matrix, Chris Watson, 2015/07/07
- Re: [igraph] Shortest path matrix, seema aswani, 2015/07/12
- Re: [igraph] Shortest path matrix, Gábor Csárdi, 2015/07/14