This project has retired. For details please refer to its Attic page.
SimpleTriangleClosingComputation (Apache Giraph Parent 1.4.0-SNAPSHOT API)
org.apache.giraph.examples

Class SimpleTriangleClosingComputation

• All Implemented Interfaces:

```public class SimpleTriangleClosingComputation
Demonstrates triangle closing in simple, unweighted graphs for Giraph. Triangle Closing: Vertex A and B maintain out-edges to C and D The algorithm, when finished, populates all vertices' value with an array of Writables representing all the vertices that each should form an out-edge to (connect with, if this is a social graph.) In this example, vertices A and B would hold empty arrays since they are already connected with C and D. Results: If the graph is undirected, C would hold value, D and D would hold value C, since both are neighbors of A and B and yet both were not previously connected to each other. In a social graph, the result values for vertex X would represent people that are likely a part of a person X's social circle (they know one or more people X is connected to already) but X had not previously met them yet. Given this new information, X can decide to connect to vertices (peoople) in the result array or not. Results at each vertex are ordered in terms of the # of neighbors who are connected to each vertex listed in the final vertex value. The more of a vertex's neighbors who "know" someone, the stronger your social relationship is presumed to be to that vertex (assuming a social graph) and the more likely you should connect with them. In this implementation, Edge Values are not used, but could be adapted to represent additional qualities that could affect the ordering of the final result array.
• Nested Class Summary

Nested Classes
Modifier and Type Class and Description
`static class ` `SimpleTriangleClosingComputation.IntArrayListWritable`
Utility class for delivering the array of vertices THIS vertex should connect with to close triangles with neighbors
`static class ` `SimpleTriangleClosingComputation.Pair`
Quick, immutable K,V storage for sorting in tree set
• Constructor Summary

Constructors
Constructor and Description
`SimpleTriangleClosingComputation()`
• Method Summary

All Methods
Modifier and Type Method and Description
`void` ```compute(Vertex<org.apache.hadoop.io.IntWritable,SimpleTriangleClosingComputation.IntArrayListWritable,org.apache.hadoop.io.NullWritable> vertex, Iterable<org.apache.hadoop.io.IntWritable> messages)```
Must be defined by user to do computation on a single Vertex.
• Methods inherited from class org.apache.giraph.graph.AbstractComputation

`addEdgeRequest, addVertexRequest, addVertexRequest, getContext, getMyWorkerIndex, getSuperstep, getTotalNumEdges, getTotalNumVertices, getWorkerContext, getWorkerCount, getWorkerForVertex, initialize, postSuperstep, preSuperstep, removeEdgesRequest, removeVertexRequest, sendMessage, sendMessageToAllEdges, sendMessageToMultipleEdges`
• Methods inherited from class org.apache.giraph.worker.WorkerAggregatorDelegator

`aggregate, getAggregatedValue, getBroadcast, reduce, reduceMerge, setWorkerGlobalCommUsage`
• Methods inherited from class org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable

`getConf, setConf`
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Methods inherited from interface org.apache.giraph.conf.ImmutableClassesGiraphConfigurable

`getConf`
• Methods inherited from interface org.apache.giraph.conf.GiraphConfigurationSettable

`setConf`
• Methods inherited from interface org.apache.giraph.worker.WorkerBroadcastUsage

`getBroadcast`
• Methods inherited from interface org.apache.giraph.worker.WorkerReduceUsage

`reduce, reduceMerge`
• Methods inherited from interface org.apache.giraph.worker.WorkerAggregatorUsage

`aggregate`
• Methods inherited from interface org.apache.giraph.aggregators.AggregatorUsage

`getAggregatedValue`
• Constructor Detail

• SimpleTriangleClosingComputation

`public SimpleTriangleClosingComputation()`
• Method Detail

• compute

```public void compute(Vertex<org.apache.hadoop.io.IntWritable,SimpleTriangleClosingComputation.IntArrayListWritable,org.apache.hadoop.io.NullWritable> vertex,
throws IOException```
Description copied from class: `AbstractComputation`
Must be defined by user to do computation on a single Vertex.
Specified by:
`compute` in interface `Computation<org.apache.hadoop.io.IntWritable,SimpleTriangleClosingComputation.IntArrayListWritable,org.apache.hadoop.io.NullWritable,org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable>`
Specified by:
`compute` in class `AbstractComputation<org.apache.hadoop.io.IntWritable,SimpleTriangleClosingComputation.IntArrayListWritable,org.apache.hadoop.io.NullWritable,org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable>`
Parameters:
`vertex` - Vertex
`messages` - Messages that were sent to this vertex in the previous superstep. Each message is only guaranteed to have a life expectancy as long as next() is not called.
Throws:
`IOException`