graphmatch 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/graphmatch.rb +26 -0
  2. metadata +46 -0
data/lib/graphmatch.rb ADDED
@@ -0,0 +1,26 @@
1
+ class Graphmatch
2
+ def self.test_gem
3
+ "Hello, World!"
4
+ end
5
+
6
+ def self.match(left_vertices, right_vertices, edges, search_type='BFS')
7
+ vertices = left_vertices + right_vertices + [:sink, :source]
8
+
9
+ edges[:sink] = {}
10
+ edges[:source] = {}
11
+
12
+ left_vertices.each { |lv| edges[:source][lv] = 0 }
13
+ right_vertices.each { |rv| edges[rv] = { :sink => 0 } }
14
+
15
+ graph = { vertices: vertices, edges: edges }
16
+ puts graph
17
+
18
+ matching = Graphmatch::Maxflow.best_matching! graph
19
+ puts "Created matching"
20
+ puts matching
21
+
22
+ matching
23
+ end
24
+ end
25
+
26
+ require 'graphmatch/maxflow'
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: graphmatch
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.pre
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Paul Hemberger
9
+ - Victor Costan
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-02-22 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: An implementation of the Ford-Fulkerson max-flow algorithm
16
+ email: pwh@mit.edu
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/graphmatch.rb
22
+ homepage: http://rubygems.org/gems/graphmatch
23
+ licenses: []
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>'
38
+ - !ruby/object:Gem::Version
39
+ version: 1.3.1
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 1.8.24
43
+ signing_key:
44
+ specification_version: 3
45
+ summary: Optimal bipartite graph matching
46
+ test_files: []