igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] working with graphs without reindexing them


From: sergiu netotea
Subject: Re: [igraph] working with graphs without reindexing them
Date: Wed, 8 Sep 2010 16:28:00 +0200

Oh, thanks for the quick answers,

I didn't read the documentation for ncol properly, at one point it said the resulting graph is undirected, but that was about the lgl format.

I have an additional problem that I forgot to ask you about. Some of my nodes are unconnected, how should I specify them in the lgl format? The edgelist reader had the option of giving the graph size, and first i thought about using that, later realizing the node indexes are changed to match the order edges are read. This ambiguity about the node index and it's initial labeling was what set me to write my own graph loader. It is imperative for me not to lose the initial identity of a node.

Re the vertex id search by attribute name, I was planning use integers as attributes (what you termed as 'numeric vertex attribute'), so I will not need string comparison. My graph nodes are specified as integers on file anyway, and then I have a table that relates them to gene names.

Re the observation that igraph is for R and Python, I rarely use R because it sucks at rapid prototyping, and in Python I prefer networkx and graph-tool. However for heavy computation, I found igraph to be essential because it is written in C and has good algorithm support. The other option would be BGL in C++, which I used in the past, but it is a pain to write code due to Boost's massive prototyping and then there are almost no complex algorithms. BGL seems written on the concept of "write it yourself", which is making it's utility questionable in the first place. So you guys remain the only viable option for fast and efficient graph computation. Which makes me proud to say it because I did my PhD in Hungary hehe .. But if you know any alternative in C to igraph, I would be interested to see it.

Sergiu

On Wed, Sep 8, 2010 at 3:41 PM, Tamas Nepusz <address@hidden> wrote:
> 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

_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help


reply via email to

[Prev in Thread] Current Thread [Next in Thread]