Accessing the integer attribute in Vertex/Edge object directly/faster

Hi,

Given a `graph_tool.Edge` instance, is it possible to directly access the
integer value (or its index value) of the source vertex and target vertex?

My current solution is

s = int(e.source())
t = int(e.target())

I have some function that calls the above routine many times and it is not
fast enough. I am wondering if I can do it faster.

Similarly, can I access the index/integer value of a Vertex object directly?

attachment.html (782 Bytes)

Hi,

Given a `graph_tool.Edge` instance, is it possible to directly access the
integer value (or its index value) of the source vertex and target vertex?

My current solution is

s = int(e.source())
t = int(e.target())

I have some function that calls the above routine many times and it is not
fast enough. I am wondering if I can do it faster.

How could it be even more direct than the above?

Similarly, can I access the index/integer value of a Vertex object directly?

Just do:

   int(v)

where is a Vertex instance.

Best,
Tiago