Querying the index of the tuple in a list



I have an array of tuples representing the edges of a graph. I would now want to obtain the index of the tuple in the array. I’ve been using findin(myarray, (s,d)) but I get a zero element array despite the tuple being present in the array. Is there a way to get the index of the tuple in an array?



The second argument of findin is a collection of keys you want to find as documented so you are looking for s and d in the array and not (s, d). ((s, d),) should work. There’s also findfirst, findnext etc.


That worked perfect. Thanks a lot @yuyichao