Skip to content
Ruby binding for C Implementation of Davenport's algorithm
Ruby C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ext/davenport_ruby
lib
test
.autotest
.gitignore
.ruby-version
Gemfile
Gemfile.lock
History.txt
LICENSE
README.rdoc
Rakefile
davenport.gemspec

README.rdoc

davenport

home

github.com/wbreeze/davenport-ruby

code

github.com/wbreeze/davenport-ruby

rdoc

FIX (url)

bugs

github.com/wbreeze/davenport-ruby/issues

C-lib

github.com/wbreeze/davenport

DESCRIPTION:

A ranking is a partial order that, given some set of alternatives, places some before others. A preference graph, given some number of rankings, expresses the combination of all of those rankings. It is a directed, weighted graph in which the nodes represent the alternatives and the edges represent preferences.

Use this to build a preference graph from individual rankings and compute a Kemeny order, aggregated preference that minimizes the number of pair-wise disagreements with the individual rankings.

This is a Ruby binding built around a C language implementation of Davenport's algorithm, found on github at wbreeze/davenport

FEATURES/PROBLEMS:

Please see github.com/wbreeze/davenport-ruby/issues for a list of any issues and add your own there, or contact the author.

SYNOPSIS:

pg = Davenport::PreferenceGraph.new(4)
pg.add_preference([1, 3, 2, 4]);
pg.add_preference([1, 2, 2, 4]);
pg.add_preference([2, 1, 3, 4]);
pg.add_preference([1, 3, 2, 4]);
pg.davenport
=> [1, 3, 2, 4]

The single array parameter for `add_preference` has a rank number for the item at the corresponding index. For example, with four items, `[1, 2, 2, 4]` assigns rank 1 to the first item, 2 to the second and third items, and 4 to the final item. The preference, `[2, 2, 2, 1]` ranks the last item first and all of the others equally after it.

REQUIREMENTS:

See .ruby-version for the version of Ruby used in development.

This requires the Davenport library installed according to wbreeze/davenport

INSTALL:

gem install davenport

DEVELOPERS:

After checking out the source, run:

$ rake newb

This task will install any missing dependencies, run the tests/specs, and generate the RDoc.

LICENSE:

GNU Lesser General Public License v3 (LGPL-3.0)

See the file, LICENSE for the full text.

Copyright © 2019 Douglas Lovell

You can’t perform that action at this time.