Skip to content

Latest commit

 

History

History
22 lines (14 loc) · 802 Bytes

README.md

File metadata and controls

22 lines (14 loc) · 802 Bytes

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/