Author: edwardyoon
Date: Fri Mar 7 01:57:51 2014
New Revision: 1575121
URL: http://svn.apache.org/r1575121
Log:
update website
Modified:
hama/site/trunk/hama_graph_tutorial.html
Modified: hama/site/trunk/hama_graph_tutorial.html
URL:
http://svn.apache.org/viewvc/hama/site/trunk/hama_graph_tutorial.html?rev=1575121&r1=1575120&r2=1575121&view=diff
==============================================================================
--- hama/site/trunk/hama_graph_tutorial.html (original)
+++ hama/site/trunk/hama_graph_tutorial.html Fri Mar 7 01:57:51 2014
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<!--
- | Generated by Apache Maven Doxia at Mar 5, 2014
+ | Generated by Apache Maven Doxia at Mar 7, 2014
| Rendered using Apache Maven Fluido Skin 1.3.0
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <meta name="Date-Revision-yyyymmdd" content="20140305" />
+ <meta name="Date-Revision-yyyymmdd" content="20140307" />
<meta http-equiv="Content-Language" content="en" />
<title>Hama -
Graph Tutorial</title>
@@ -200,7 +200,7 @@
- <li id="publishDate" class="pull-right">Last Published:
2014-03-05</li> <li class="divider pull-right">|</li>
+ <li id="publishDate" class="pull-right">Last Published:
2014-03-07</li> <li class="divider pull-right">|</li>
<li id="projectVersion" class="pull-right">Version:
0.7.0-SNAPSHOT</li>
</ul>
@@ -245,8 +245,8 @@
<p>The user overrides the Compute() method, which will be executed at each
active vertex in every superstep. Predefined Vertex methods allow Compute() to
query information about the current vertex and its edges, and to send messages
to other vertices. Compute() can inspect the value associated with its vertex
via GetValue().</p>
- <div class="section"><h3>VertexReader<a name="VertexReader"></a></h3></div>
- <p>You can create your own VertexReader for your data format by exending
org.apache.hama.graph.<b>VertexInputReader</b> class.
+ <div class="section"><h3>Vertex Reader and Writer<a
name="Vertex_Reader_and_Writer"></a></h3></div>
+ <p>Hama Graph provides very flexible input and output options, allows
allows to extract Vertex from your data without any pre-processing. You can
create your own VertexReader for your data format by exending
org.apache.hama.graph.<b>VertexInputReader</b> class.
For example, an sequence file contains a linked list of Vertex, can be
parse as following:
</p>
@@ -267,6 +267,20 @@
}
}
</pre></div>
+
+ And also, you can create your own Writer by implementing
org.apache.hama.graph.<b>VertexOutputWriter</b> class.
+ See the SemiClusterVertexOutputWriter example:
+ <div><pre>
+ @Override
+ public void write(Vertex<V, E, M> vertex,
+ BSPPeer<Writable, Writable, KEYOUT, VALUEOUT, GraphJobMessage>
peer)
+ throws IOException {
+ SemiClusterMessage vertexValue = (SemiClusterMessage) vertex.getValue();
+ peer.write((KEYOUT) vertex.getVertexID(), (VALUEOUT) new Text(vertexValue
+ .getSemiClusterContainThis().toString()));
+ }
+ </pre></div>
+
<div class="section"><h3>Combiners<a name="Combiners"></a></h3></div>
<p>Sending a message to another vertex that exists on a different machine
has some overhead. However if the algorithm doesn't require each message
explicitly but a function of it (example sum) then combiners can be used.</p>
<div class="section"><div class="section"><h4>Write your own Combiner<a
name="Write_your_own_Combiner"></a></h4>
@@ -300,7 +314,7 @@
this.getAggregatedValue(index);</pre></div>
</div><div class="section"><h4>Write your own aggregators<a
name="Write_your_own_aggregators"></a></h4>
- <p>To write your own aggregator, you have to extend AbstractAggregator class
and implement the methods of #aggregate(M value) and #getValue(). For more,
please see the default implementation of aggregators in org.apache.hama.graph
package.</p>
+ <p>To write your own aggregator, you have to extend
org.apache.hama.graph.<b>AbstractAggregator</b> class and implement the methods
of #aggregate(M value) and #getValue(). For more, please see the default
implementation of aggregators in org.apache.hama.graph package.</p>
</div></div><div class="section"><h3>Example: PageRankVertex<a
name="Example:_PageRankVertex"></a></h3></div>
<p>To solve the Page Rank problem using Hama Graph, you can extends the
Vertex class to create a PageRankVertex class.
In this example, the algorithm described Google's Pregel paper was used. The
value of a vertex represents the tentative page rank of the vertex. The graph
is intialized with each vertex value equal to 1/numOfVertices. In each of the
first 30 supersteps, each vertex sends its tentative page rank along all of its
outgoing edges.