Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredbeck committed Feb 23, 2014
0 parents commit e3cd4fc
Show file tree
Hide file tree
Showing 17 changed files with 153 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*.gem
*.rbc
.bundle
.config
.idea
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--format documentation
--color
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.0
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: ruby
rvm:
- 2.1.0
script: rspec spec
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in graph_matching.gemspec
gemspec
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2014 Jared Beck

MIT License

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.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# GraphMatching

Finds maximum matchings in undirected graphs.

Implements modern algorithms for finding maximum cardinality
and maximum weighted matchings in undirected graphs and bigraphs.

## Usage

```ruby
require 'graph_matching'
g = GraphMatching::BipartiteGraph.new
g.add_edge('alice', 'bob')
g.add_edge('christine', 'don')
g.maximum_cardinality_matching.class
#=> GraphMatching::Matching
g.maximum_cardinality_matching.edges
#=> #<Set: {['alice', 'don'], ['christine', 'bob']}>
```
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
32 changes: 32 additions & 0 deletions graph_matching.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'graph_matching/version'

Gem::Specification.new do |spec|
spec.name = 'graph_matching'
spec.version = GraphMatching::VERSION
spec.authors = ['Jared Beck']
spec.email = ['jared@jaredbeck.com']
spec.summary = 'Finds maximum matchings in undirected graphs.'
spec.description = <<-EOS
Implements modern algorithms for finding maximum cardinality
and maximum weighted matchings in undirected graphs and bigraphs.
EOS
spec.homepage = ''
spec.license = 'MIT'

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.1.0'

spec.add_runtime_dependency 'rgl', '~> 0.4.0'

spec.add_development_dependency 'bundler', '~> 1.5'
spec.add_development_dependency 'rspec-core', '~> 3.0.0.beta2'
spec.add_development_dependency 'rspec-expectations', '~> 3.0.0.beta2'
spec.add_development_dependency 'rspec-mocks', '~> 3.0.0.beta2'
end
6 changes: 6 additions & 0 deletions lib/graph_matching.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "graph_matching/bipartite_graph"
require "graph_matching/graph"
require "graph_matching/version"

module GraphMatching
end
6 changes: 6 additions & 0 deletions lib/graph_matching/bipartite_graph.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require_relative 'graph'

module GraphMatching
class BipartiteGraph < Graph
end
end
7 changes: 7 additions & 0 deletions lib/graph_matching/graph.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'rgl/mutable'

module GraphMatching
class Graph
include RGL::MutableGraph
end
end
3 changes: 3 additions & 0 deletions lib/graph_matching/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module GraphMatching
VERSION = "0.0.1"
end
7 changes: 7 additions & 0 deletions spec/graph_matching/bipartite_graph_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

describe GraphMatching::BipartiteGraph do
it 'is a Graph' do
expect(described_class.new).to be_a(GraphMatching::Graph)
end
end
7 changes: 7 additions & 0 deletions spec/graph_matching/graph_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

describe GraphMatching::Graph do
it 'is an RGL::MutableGraph' do
expect(described_class.new).to be_a(RGL::MutableGraph)
end
end
7 changes: 7 additions & 0 deletions spec/graph_matching_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

describe GraphMatching do
it 'should have a version number' do
expect(GraphMatching::VERSION).to_not be_nil
end
end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'graph_matching'

0 comments on commit e3cd4fc

Please sign in to comment.