||1 year ago|
|src||1 year ago|
|.gitignore||1 year ago|
|README.md||1 year ago|
TDMG is a Haskell module for generating directed graphs according to the technique from the above tweet. A brief overview of that technique:
Given an arbitrary base,
- Pick a one or two digit number
- Create a list of all of the two digit multiples of that number
- For every digit that appears in the list, create a node in your graph
- For every number in the list, create an arrow from the most significant digit's node to the least significant digit's node
Edgeis a data structure containing two integers, a head and a tail. It represents an edge in a directed graph.
The constructor for
Edgetakes the form
Edge tail head, where
Graphis a data structure composed of a cons list of
Edges. It represents a directed graph.
The constructors for
Graph Edge Graph.
fromList :: [(Integer,Integer)] -> Graph
fromListconverts a list of the form
gen :: Integer -> Integer -> Graph
gengenerates the directed graph for some arbitrary base and some arbitrary number. It takes the form
gen base num.
TDMG also ships with an executable. This can be compiled using
ghc. Run the
executable for usage instructions. For all intents and purposes, it can be
thought of as exposing the
gen function to the system.