[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [igraph] vertex sequence Q

**From**: |
Tamas Nepusz |

**Subject**: |
Re: [igraph] vertex sequence Q |

**Date**: |
Sun, 19 Apr 2015 21:40:03 +0200 |

**User-agent**: |
Mutt/1.5.23 (2014-03-12) |

>* Dear group,*
>* I had a sub graph induced form larger one*
>* the sub-graph is as follows*
>* [...] *
>* get.all.shortest.paths(subg,22)*
>* *
>* I got this Error *
>* Error in .Call("R_igraph_get_all_shortest_paths", graph, as.igraph.vs(graph, *
>* : *
>* At structural_properties.c:992 : cannot get shortest paths, Invalid vertex *
>* id*
>* So I used the vertex place in the sequence*
This is because the internal IDs of the vertices and edges in igraph are always
consecutive integers from 0 to |V|-1 (or |E|-1), and whenever you pass
a numeric argument to an igraph function that expects a vertex or an edge, it
will treat it as the ID of the vertex or edge. However, if you pass a string
for a vertex argument, it will be looked up in the "name" vertex attribute. So,
the easiest is probably to ensure that all your vertex names are strings in the
original graph, then you can take the subgraph and keep on using the names (as
strings of course).
--
T.