You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@giraph.apache.org by "Jakob Homan (Created) (JIRA)" <ji...@apache.org> on 2012/04/07 22:22:17 UTC
[jira] [Created] (GIRAPH-174) ConnectedComponentsVertex for loops
can be replaced with for-each loops
ConnectedComponentsVertex for loops can be replaced with for-each loops
-----------------------------------------------------------------------
Key: GIRAPH-174
URL: https://issues.apache.org/jira/browse/GIRAPH-174
Project: Giraph
Issue Type: Improvement
Reporter: Jakob Homan
Priority: Trivial
{code} // First superstep is special, because we can simply look at the neighbors
if (getSuperstep() == 0) {
for (Iterator<IntWritable> edges = iterator(); edges.hasNext();) {
int neighbor = edges.next().get();
if (neighbor < currentComponent) {
currentComponent = neighbor;
}
}
// Only need to send value if it is not the own id
if (currentComponent != getVertexValue().get()) {
setVertexValue(new IntWritable(currentComponent));
for (Iterator<IntWritable> edges = iterator();
edges.hasNext();) {
int neighbor = edges.next().get();
if (neighbor > currentComponent) {
sendMsg(new IntWritable(neighbor), getVertexValue());
}
}
}{code}
Both of the for loops in this chunk from ConnectedComponentsVertex can be replaced with for(IntWritable i : iterator()) loops to be more idiomatic.
--
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
[jira] [Updated] (GIRAPH-174) ConnectedComponentsVertex for loops
can be replaced with for-each loops
Posted by "Roman K (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/GIRAPH-174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Roman K updated GIRAPH-174:
---------------------------
Attachment: GIRAPH-174.patch
Both loops changed to a more convenient way.
Tested with:
mvn test
ConnectedComponentsVertexTest JUnit test separately
> ConnectedComponentsVertex for loops can be replaced with for-each loops
> -----------------------------------------------------------------------
>
> Key: GIRAPH-174
> URL: https://issues.apache.org/jira/browse/GIRAPH-174
> Project: Giraph
> Issue Type: Improvement
> Reporter: Jakob Homan
> Priority: Trivial
> Labels: newbie
> Attachments: GIRAPH-174.patch
>
>
> {code} // First superstep is special, because we can simply look at the neighbors
> if (getSuperstep() == 0) {
> for (Iterator<IntWritable> edges = iterator(); edges.hasNext();) {
> int neighbor = edges.next().get();
> if (neighbor < currentComponent) {
> currentComponent = neighbor;
> }
> }
> // Only need to send value if it is not the own id
> if (currentComponent != getVertexValue().get()) {
> setVertexValue(new IntWritable(currentComponent));
> for (Iterator<IntWritable> edges = iterator();
> edges.hasNext();) {
> int neighbor = edges.next().get();
> if (neighbor > currentComponent) {
> sendMsg(new IntWritable(neighbor), getVertexValue());
> }
> }
> }{code}
> Both of the for loops in this chunk from ConnectedComponentsVertex can be replaced with for(IntWritable i : iterator()) loops to be more idiomatic.
--
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
[jira] [Assigned] (GIRAPH-174) ConnectedComponentsVertex for loops
can be replaced with for-each loops
Posted by "Hyunsik Choi (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/GIRAPH-174?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hyunsik Choi reassigned GIRAPH-174:
-----------------------------------
Assignee: Roman K
> ConnectedComponentsVertex for loops can be replaced with for-each loops
> -----------------------------------------------------------------------
>
> Key: GIRAPH-174
> URL: https://issues.apache.org/jira/browse/GIRAPH-174
> Project: Giraph
> Issue Type: Improvement
> Reporter: Jakob Homan
> Assignee: Roman K
> Priority: Trivial
> Labels: newbie
> Attachments: GIRAPH-174.patch
>
>
> {code} // First superstep is special, because we can simply look at the neighbors
> if (getSuperstep() == 0) {
> for (Iterator<IntWritable> edges = iterator(); edges.hasNext();) {
> int neighbor = edges.next().get();
> if (neighbor < currentComponent) {
> currentComponent = neighbor;
> }
> }
> // Only need to send value if it is not the own id
> if (currentComponent != getVertexValue().get()) {
> setVertexValue(new IntWritable(currentComponent));
> for (Iterator<IntWritable> edges = iterator();
> edges.hasNext();) {
> int neighbor = edges.next().get();
> if (neighbor > currentComponent) {
> sendMsg(new IntWritable(neighbor), getVertexValue());
> }
> }
> }{code}
> Both of the for loops in this chunk from ConnectedComponentsVertex can be replaced with for(IntWritable i : iterator()) loops to be more idiomatic.
--
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