|
From: | Ahmed Abdeen Hamed |
Subject: | Re: [igraph] searching by node index: runtime analysis |
Date: | Mon, 5 Jan 2015 16:25:01 -0500 |
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.
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |