jaredbeck / graph_matching

Finds maximum matchings in undirected graphs.
MIT License
45 stars 17 forks source link

@weight-array to small, if numbers are not consequtive #11

Closed mlujr closed 3 years ago

mlujr commented 3 years ago

in lib/graph_matching/graph/weighted.rb:

in constructor [] calculate the maximum index max_idx = weightless_edges.map { |e| e.max}.max + 1 g.init_weights(max_idx)

and add a paramter to init_weights with default

def init_weights(e=numvertices) @weight = Array.new(e) { || Array.new(e) } end

jaredbeck commented 3 years ago

Hi! It sounds like you have a specific change you'd like to suggest. If so, can you make a PR with tests, please?

mlujr commented 3 years ago

created a pull request with simple test