Ordering of edges returned by EdgePropertyMap.getArray()

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Ordering of edges returned by EdgePropertyMap.getArray()

Ioana K-Hulpus
Hi,

I am trying to set a property (my_prop) for all the edges of a graph, where
the property values for all edges are stored in an array A.
My plan is to use my_prop.get_array()[:] = A.
Now, in what order do the values need to be in A to make sure each value
goes to the correct edge? In other words, in what order are the properties
of edges returned by get_array() ?
I initially thought the order would be the same as the one returned by
calling g.get_edges(), but that does not set them correctly. When I tried
with g.edge_index, it seems to work. Can I rely on setting the value of an
edge E in A at position A[g.edge_index[E]] ?

Thanks a lot,
Ioana




--
Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: Ordering of edges returned by EdgePropertyMap.getArray()

Tiago Peixoto
Administrator
Am 07.05.20 um 11:33 schrieb Ioana K-Hulpus:
> Can I rely on setting the value of an
> edge E in A at position A[g.edge_index[E]] ?

Yes.

--
Tiago de Paula Peixoto <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: Ordering of edges returned by EdgePropertyMap.getArray()

Ioana K-Hulpus
Beautiful! Thanks! 

On Thu 7. May 2020 at 15:59, Tiago de Paula Peixoto <[hidden email]> wrote:
Am 07.05.20 um 11:33 schrieb Ioana K-Hulpus:
> Can I rely on setting the value of an
> edge E in A at position A[g.edge_index[E]] ?

Yes.

--
Tiago de Paula Peixoto <[hidden email]>

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool