graphmatch 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/graphmatch.rb +16 -4
- metadata +1 -1
data/lib/graphmatch.rb
CHANGED
@@ -4,15 +4,27 @@ class Graphmatch
|
|
4
4
|
# The edges must be specified as a hash of hashes, the keys being left vertices
|
5
5
|
# and the values be a hash of right vertices and the weights to them.
|
6
6
|
#
|
7
|
-
# Ex.
|
7
|
+
# Ex.
|
8
|
+
# Matching ['a', 'b'] to [1, 2], restrict it so 'a' can only reach 2.
|
8
9
|
# All path lengths are uniform (= 0)
|
9
10
|
#
|
10
|
-
#
|
11
|
-
#
|
11
|
+
# left = ["a", "b"]
|
12
|
+
# right = [1, 2]
|
12
13
|
# edges = {"a" => {2 => 0},
|
13
14
|
# "b" => {1 => 0, 2 >= 0}}
|
15
|
+
# Graphmatch.match(left, right, edges)
|
16
|
+
#
|
17
|
+
# Ex.
|
18
|
+
# Matching ['a', 'b'] to ['y', 'z'] with edge weights. 'a' is matched to 'y',
|
19
|
+
# 'b' is matched to 'z'
|
14
20
|
#
|
15
|
-
#
|
21
|
+
# left = ['a', 'b']
|
22
|
+
# right ['y', z']
|
23
|
+
# edges = {'a' => {'y' => 1, 'z' => 100},
|
24
|
+
# 'b' => {'y' => 100, 'z' => 1}}
|
25
|
+
# Graphmatch.match(left, right, edges, search = :min_cost)
|
26
|
+
#
|
27
|
+
# If the path lengths are equal, set search to :shortest_path.
|
16
28
|
# If the path lengths vary, set search to :min_cost to optimize for min-cost max-flow
|
17
29
|
#
|
18
30
|
# @param left_vertices [Array] list of names of vertices on the left
|