FYI

```ruby
connections = {}
connections[heading] ||= 0
connections[heading] += weight
```

reduces nicely to:

```ruby
connections = Hash.new(0)
connections[heading] += weight
```