> I am using the "igraph_shortest_paths()" function, and I noticed that the > "from" and "to" should be vertex ids. Is there some way to use the gene > symbol list instead of their ids? That will be much more convenient. Well, that's why most people use igraph from R or Python because the higher level interfaces hide some of the complexities of the C core. One particular complexity is that the C layer identifies vertices and edges by numeric IDs, and vertex or edge attributes usually have no special meaning. If you know the name of the vertex in the C layer and you need the ID, you have to build some kind of a mapping from vertex names back to vertex IDs. In the simplest case, you can use an appropriate attribute handler macro in the C interface to get a vector that contains all the vertex names (ordered by the vertex IDs), and then you can run a linear search on the vector to find the name you are looking for; see this macro for instance:
http://igraph.sourceforge.net/doc/html/ch12s02.html#VASV However, if you want to do this frequently and efficiently, you have to build a hash table or something like that which lets you obtain the ID of a vertex from its name faster than in linear time. Since C has no built-in hash table data structure, you have to build that yourself. In the R and Python interfaces, the mapping from vertex names to IDs is handled transparently behind the scenes, that's why you can supply vertex names instead of IDs to most functions. -- T. _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
