I don't think there's an obvious "policy" in place for this, but in general 
I'd agree that it's better foo[i] == collect(foo)[i].

But there's no reason you can't have different types of iterators that visit 
different types of edges:

    for edge in all_edges(graph)
        # visits symmetric edges twice
    end

    for edge in unique_edges(graph)
        # visits only the ones with d<s
    end

This will allow you to have consistency while also providing the algorithmic 
flexibility you want.

--Tim

On Friday, November 13, 2015 01:40:18 PM Seth wrote:
> Is it always expected that foo[i] == collect(foo)[i]? I'm running into a
> bit of an issue with undirected graphs where this may not be the case for
> collections of graph edges, and I'm wondering how much time I should sink
> into fixing a problem that might not even exist.
> 
> The discrepancy is with an edge (s,d) where s > d - in the iterator they're
> ignored in undirected graphs since we represent it as d,s in this case
> (smaller vertex first), but in the adjacency list that is used to build the
> getindex, they're both there. So we can have Edge(20,10) in edges(graph) be
> true, but Edge(20,10) in collect(edges(graph)) be false (Edge(10,20) will
> be in the collection).
> 
> Thanks for any input.

Reply via email to