giraph-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alessandro Presta (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GIRAPH-221) Make iteration over edges more explicit
Date Thu, 28 Jun 2012 16:03:44 GMT

    [ https://issues.apache.org/jira/browse/GIRAPH-221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13403183#comment-13403183
] 

Alessandro Presta commented on GIRAPH-221:
------------------------------------------

I'm not trying to eliminate the for-each, on the contrary I want to make it more explicit
what we're iterating on, so that we stop using the .iterator() version instead.

What I'm unsure about is whether we should ask concrete vertex classes to implement outEdgesIterator()
or directly outEdges().

As for BasicVertex being an Iterable: I don't see a Vertex as a Collection of edges, considering
there's much more to it (most notably a value). I think the form {code:java} for (I edge :
this){code} illustrates this well. I think a Vertex *has-a* Collection of edges.
The Pregel API, for example, includes {code:java}OutEdgeIterator GetOutEdgeIterator(){code}

Not a big deal in the end, just trying to find the most intuitive API.
                
> Make iteration over edges more explicit
> ---------------------------------------
>
>                 Key: GIRAPH-221
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-221
>             Project: Giraph
>          Issue Type: Improvement
>          Components: graph
>            Reporter: Alessandro Presta
>            Assignee: Alessandro Presta
>            Priority: Minor
>
> Is there any particular reason why BasicVertex implements Iterable?
> It seems to me that doing
> {code:java}
> for (I neighbor : vertex)
> {code}
> is not that explicit, and
> {code:java}
> for (I neighbor : this)
> {code}
> gets even obscure (which may be why all examples in the codebase explicitly instantiate
an iterator and call next()).
> What I propose is a more explicit
> {code:java}
> Iterator<I> outEdgesIterator()
> {code}
> and also a convenient
> {code:java}
> Iterable<I> outEdges()
> {code}
> so, for example, an algorithm can use
> {code:java}
> for (IntWritable neighbor : outEdges())
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message