adjacency-matrix

Adjacency Matrix Generator

Build Status

Notes

This was fine. I cut corners by not checking the entire edge for validity.

Unfortunately the backslashes look ugly. This could be avoided by putting the inputs into a non-Crystal file.

Don't forget to negate the forbidden direction when hitting a dummy node. Otherwise you could get into an infinite loop traveling between two of them.

The work to prevent tracing each path twice is a premature optimization, but it's interesting. Requires keeping track of which direction you just traveled from. Make sure to do this right with dummy nodes too.

Source

https://www.reddit.com/r/dailyprogrammer/comments/3h0uki/

Repository

adjacency-matrix

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • about 7 years ago
  • October 17, 2016
License

Links
Synced at

Fri, 17 May 2024 17:57:48 GMT

Languages