igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] searching by node index: runtime analysis


From: Tamas Nepusz
Subject: Re: [igraph] searching by node index: runtime analysis
Date: Mon, 5 Jan 2015 22:16:15 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

Hi,

> What the runtime analysis for retrieving the index of a node by its name?

It depends. If you are using the C core directly, you are on your own --
looking up a vertex by name would involve scanning the vertices and comparing
their name attribute with the name you are looking for. Or you can implement
your own data structure (e.g., a hash table) to speed up the lookups. If you
are using the Python interface, the situation is a bit better because the
"name" attribute is indexed behind the scenes so looking up a vertex by name
should be as fast as a Python dictionary lookup. (But watch out for a caveat:
g.vs.find("name") is fast but g.vs.find(name="name") is slow; this is a bug
that will be rectified soon). I cannot tell anything about the R interface,
though, because I'm not familiar with its internals.

-- 
T.



reply via email to

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