I'm new to graph tool and still not sure about how to use it idiomatically.  So, why would one go through the process of creating a property map, activating and deactivating a filter rather than just creating a numpy mask and masking an array of edges. (I guess edges is an iterator so masking it isn't as super simple and efficient as with an array)

Flavian, I dont see one either. Look at Graph.edges.__doc__

On Jul 16, 2014 10:47 AM, "Flavien Lambert" <petit.lepton@gmail.com> wrote:

That is a good question. I was wondering if so.
On the same topic, I did not find the function for getting the edge from the edge index. There is one for vertices like vertex(n) but for edges?

On 16 Jul 2014 23:22, "..." <offonoffoffonoff@gmail.com> wrote:

Are the indices in the array not the indices of the edges?  I'm not sure, but I think you could be accessing edges based on indices you precomputed rather than edge objects.

On Jul 16, 2014 9:51 AM, "Flavien Lambert" <petit.lepton@gmail.com> wrote:

Hi Elliott, I know that the get_array is very efficient but the thing is I have to know exactly what are the edges I am dealing with.

To be more precise, I run loops over the shortest paths which I computed before and stored in a file. Therefore, each iteration makes access to a tiny fraction of the network and I must keep track of the edges involved. That is why I was giving the example of single access instead of global one though .a.

Best,
F.

On 16 Jul 2014 22:04, "..." <offonoffoffonoff@gmail.com> wrote:

You know you can get the edges, vertices, and property maps as numpy arrays by using the .a method. You should be able to do whatever you need much faster with arrays than dictionaries.

On Jul 16, 2014 3:50 AM, "Flavien Lambert" <petit.lepton@gmail.com> wrote:
Hi everyone, to compute some functions I needed to loop over a bunch of edges. I realized that the call to property maps seems slow compare to a dictionary. I am a bit surprised since I was told - I am not an expert in python - that a query in a dictionary was already. So I was wondering if I made a mistake in using graph_tool. Following is an example of comparison.
Best,
F.


In [3]:





_network = gt.load_graph(_dataFolder + 'networkLTA-2.0-scc.xml')





_network = gt.load_graph(_dataFolder + 'networkLTA-2.0-scc.xml')
In [4]:





_network.list_properties()





destination    (vertex)  (type: long double)
_graphml_vertex_id (vertex)  (type: string)
origin         (vertex)  (type: long double)
_graphml_edge_id (edge)    (type: string)
speed          (edge)    (type: long double)
name           (edge)    (type: string)
time           (edge)    (type: long double)
In [5]:





_edgeIds = _network.edge_properties['_graphml_edge_id']





_times = _network.edge_properties["time"]





_speeds = _network.edge_properties["speed"]





 





_origin = _network.vertex_properties['origin']





_destination = _network.vertex_properties['destination']
In [8]:





_edges = [_e for _e in _network.edges()]





%time for _e in _network.edges() : a = _speeds[_e]





 





_speedDict = {}





for _e in _edges :





    _speedDict[_network.edge_index[_e]] = _speeds[_e]





_indexes = [_network.edge_index[_e] for _e in _network.edges()]





%time for _n in _indexes : a = _speedDict[_n]





CPU times: user 102 ms, sys: 5 ms, total: 107 ms
Wall time: 103 ms
CPU times: user 2 ms, sys: 0 ns, total: 2 ms
Wall time: 1.94 ms

_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
http://lists.skewed.de/mailman/listinfo/graph-tool


_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
http://lists.skewed.de/mailman/listinfo/graph-tool


_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
http://lists.skewed.de/mailman/listinfo/graph-tool


_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
http://lists.skewed.de/mailman/listinfo/graph-tool


_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
http://lists.skewed.de/mailman/listinfo/graph-tool