Hi, I have quickly explored the documentation. So I am sorry if I have overlooked something essential. I use a graph file exported from gephi (xml file(graphml)) </node> <node id="672712520"> <data key="label">672712520</data> <data key="size">10.0</data> <data key="r">153</data> <data key="g">153</data> <data key="b">153</data> <data key="x">25781.25</data> <data key="y">14798.744</data> </node> However, the the node id object is not listed as a property map (in my case it's not the same as the label for all nodes) Is it possible to access this value? Second, what is the optimal method to find the vertice number for a known property value(ID or label)? Thanks, Håvard -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
Hi, On 06/02/2011 05:04 PM, Håvard Wahl Kongsgård wrote:
Hi, I have quickly explored the documentation. So I am sorry if I have overlooked something essential.
I use a graph file exported from gephi (xml file(graphml))
</node> <node id="672712520"> <data key="label">672712520</data> <data key="size">10.0</data> <data key="r">153</data> <data key="g">153</data> <data key="b">153</data> <data key="x">25781.25</data> <data key="y">14798.744</data> </node>
However, the the node id object is not listed as a property map (in my case it's not the same as the label for all nodes) Is it possible to access this value?
The id of a vertex is not interpreted to be a property. This is simply used internally in the graphml format to differentiate between vertices. In case the file uses "canonical" indexes (indexes go from n0 to nN-1), then the ids correspond to the vertex index used in graph-tool, otherwise the ids are not visible after the graph is loaded. If you want the ids to be visible, you have to mirror them as a an actual property.
Second, what is the optimal method to find the vertice number for a known property value(ID or label)?
There is a find_vertex() function available, which does what you want, but it is O(N) (in C++). If you want to do it faster, you have to build your own dictionary... Cheers, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
OK, I tried this g = load_graph("/home/havard/Untitled.xml",file_format='xml') name = g.vertex_properties["label"] print find_vertex(g,name,'1313754909') - why does find_vertex return multiple matches? I in my case the nodes have a unique label. -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 06/02/2011 08:54 PM, Håvard Wahl Kongsgård wrote:
OK, I tried this
g = load_graph("/home/havard/Untitled.xml",file_format='xml')
name = g.vertex_properties["label"]
print find_vertex(g,name,'1313754909')
- why does find_vertex return multiple matches? I in my case the nodes have a unique label.
Hm, this is because you just found a bug in the string ordering code... I've just corrected it in the git version. Cheers, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
Hi, tried the git version. The compiler gave no error but when imported in python RuntimeError: module compiled against API version 6 but this version of numpy is 4 Traceback (most recent call last): -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 06/03/2011 11:50 AM, Håvard Wahl Kongsgård wrote:
Hi, tried the git version.
The compiler gave no error but when imported in python
RuntimeError: module compiled against API version 6 but this version of numpy is 4 Traceback (most recent call last):
You have to double check if you compiled graph-tool against the same version of numpy which is being loaded... Cheers, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
Thanks, I had two versions of numpy installed. Another question: With the Search algorithms how do I select I target node? -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 06/03/2011 02:43 PM, Håvard Wahl Kongsgård wrote:
Thanks, I had two versions of numpy installed.
Another question: With the Search algorithms how do I select I target node?
I'm not sure I understand what you mean. Are you talking about find_vertex() or the functions in the search module? Cheers, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
Sorry, I meant the functions in the search module. Also, with your latest version find_vertex() now works correctly on int but not for character ID's. If the ID is a character multiple nodes there are multiple matches -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 06/03/2011 04:22 PM, Håvard Wahl Kongsgård wrote:
Sorry, I meant the functions in the search module.
For the search functions you have to subclass the appropriate visitor classes in order to do something useful. You do not usually just want to find a vertex, you want to record something about the search...
Also, with your latest version find_vertex() now works correctly on int but not for character ID's. If the ID is a character multiple nodes there are multiple matches
I cannot reproduce this. Would you be able to provide an example? Cheers, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
Håvard Wahl Kongsgård -
Tiago de Paula Peixoto