Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/igrigorik/pregel
Single-node implementation of Google's Pregel framework for graph processing.
https://github.com/igrigorik/pregel
Last synced: about 2 months ago
JSON representation
Single-node implementation of Google's Pregel framework for graph processing.
- Host: GitHub
- URL: https://github.com/igrigorik/pregel
- Owner: igrigorik
- Created: 2010-10-30T23:12:39.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2012-02-10T17:09:01.000Z (almost 13 years ago)
- Last Synced: 2024-10-31T13:46:44.361Z (2 months ago)
- Language: Ruby
- Homepage:
- Size: 104 KB
- Stars: 74
- Watchers: 6
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pregel
Single-node implementation of Google's Pregel framework for graph processing. It does not provide any of the distributed components, but implements the core functional pieces within a single Ruby VM such that you can develop and run iterative graph algorithms as if you had the full power of Pregel at your disposal.
To learn more about Pregel see following resources:
* [Pregel, a system for large-scale graph processing](http://portal.acm.org/citation.cfm?id=1582716.1582723)
* [Large-scale graph computing at Google](http://googleresearch.blogspot.com/2009/06/large-scale-graph-computing-at-google.html)
* [Phoebus](http://github.com/xslogic/phoebus) is a distributed Erlang implementation of Pregel# PageRank example with Pregel
To run a PageRank computation on an arbitrary graph, you simply specify the vertices & edges, and then define a compute function for each vertex. The coordinator then partitions the work between a specified number of workers (Ruby threads, in our case), and iteratively executes "supersteps" until we converge on a result. At each superstep, the vertex can read and process incoming messages and then send messages to other vertices. Hence, the full PageRank implementation is:```ruby
class PageRankVertex < Vertex
def compute
if superstep >= 1
sum = messages.inject(0) {|total,msg| total += msg; total }
@value = (0.15 / num_nodes) + 0.85 * sum
endif superstep < 30
deliver_to_all_neighbors(@value / neighbors.size)
else
halt
end
end
end
```The above algorithm will run for 30 iterations, at which point all vertices will mark themselves as inactive and the coordinator will terminate our computation.
* [Computing PageRank for a simple circular graph](https://github.com/igrigorik/pregel/blob/master/spec/coordinator_spec.rb#L52)
* [Computing PageRank for a more complex grap](https://github.com/igrigorik/pregel/blob/master/spec/coordinator_spec.rb#L70)# License
(The MIT License)
Copyright (c) 2010 Ilya Grigorik
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.