Hi all, Is there any way in igraph package that if once i find the shortest path between two nodes using get.shortest.paths. Like for example
get.shortest.paths(g, 5 , 2) will return 5 4 3 2. Then if i just want to find the intermediate nodes except this two nodes 5 and 2..?? As a result i want to print the sequence 4 3 2. Thank you. On Mon, Jul 6, 2015 at 2:35 PM, Gábor Csárdi <[email protected]> wrote: > 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 <[email protected]> > wrote: > > Can you give any examle..?? > > > > On Mon, Jul 6, 2015 at 1:04 PM, seema aswani <[email protected]> > 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 <[email protected]> > >> 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 <[email protected]> > >>> 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 <[email protected] > > > >>> > 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 < > [email protected]> > >>> >> wrote: > >>> >>> > >>> >>> On Sun, Jul 5, 2015 at 4:18 PM, seema aswani < > [email protected]> > >>> >>> 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 > >>> >>> [email protected] > >>> >>> https://lists.nongnu.org/mailman/listinfo/igraph-help > >>> >>> > >>> >> > >>> > > >>> > > >>> > _______________________________________________ > >>> > igraph-help mailing list > >>> > [email protected] > >>> > https://lists.nongnu.org/mailman/listinfo/igraph-help > >>> > > >>> > >>> _______________________________________________ > >>> igraph-help mailing list > >>> [email protected] > >>> https://lists.nongnu.org/mailman/listinfo/igraph-help > >> > >> > > > > > > _______________________________________________ > > igraph-help mailing list > > [email protected] > > https://lists.nongnu.org/mailman/listinfo/igraph-help > > > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help >
_______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
