[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] working with graphs without reindexing them
From: |
Tamas Nepusz |
Subject: |
Re: [igraph] working with graphs without reindexing them |
Date: |
Wed, 8 Sep 2010 14:41:46 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
> To all this I see one problem though: in igraph I found no function that
> returns the node id that has a certain label. Of course I could write my own
> function for that as well, that loops through all nodes and returns the node
> id that has a certain label. But I am afraid it is not very optimized.
If you worry about performance, you can use a red-black tree (or a hash
table, or whichever you prefer) to look up IDs based on names; a C
implementation of red-black trees is here:
http://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
igraph also contains a trie data structure that you might find useful if
your IDs are strings. This is undocumented, but the function headers are
in types.h, and you can also browse the source code for the trie data
structure here:
http://bazaar.launchpad.net/~igraph/igraph/0.5-main/annotate/head%3A/src/igraph_trie.c
--
Tamas