aboutsummaryrefslogtreecommitdiffstats
path: root/src/Main.hs
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-11-09 20:34:24 +0000
committerYann Herklotz <ymherklotz@gmail.com>2018-11-09 20:34:24 +0000
commit8e4e3c6bfdb6a34650646cbc2330377771b74313 (patch)
treeaad1688d76638dd2719543c809181e9c2148d8df /src/Main.hs
parent34f044c3f91a747186c3ea7f700049278b40678d (diff)
downloadverismith-8e4e3c6bfdb6a34650646cbc2330377771b74313.tar.gz
verismith-8e4e3c6bfdb6a34650646cbc2330377771b74313.zip
Random generation of DAG
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/Main.hs b/src/Main.hs
index bc80b49..5eebc30 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -9,30 +9,16 @@ import Data.Graph.Inductive.PatriciaTree
import Data.GraphViz.Attributes.Complete
import Data.Text.Lazy
import Data.GraphViz.Commands
-import Data.Graph.Generators.Random.WattsStrogatz
import System.Random.MWC
-import Data.Graph.Generators.FGL
-import Data.Graph.Generators
-type Input = Bool
-
-data Gate = Nand
- | And
- | Or
- deriving (Show, Eq, Ord)
+import Test.VeriFuzz.Graph.Random
+import Test.VeriFuzz.Types
instance Labellable Gate where
toLabelValue gate = StrLabel . pack $ show gate
-instance Arbitrary Gate where
- arbitrary = elements [Nand, And, Or]
-
-randomTree :: Gr Gate String
-randomTree = mkGraph [(1, Nand), (2, Nand), (3, Or), (4, Nand), (5, Nand), (6, Nand), (7, Or)] [(3, 1, ""), (7, 1, ""), (5, 1, ""), (6, 2, ""), (7, 2, ""), (5, 2, ""), (1, 4, ""), (2, 4, ""), (3, 4, ""), (6, 4, "")]
-
main :: IO FilePath
--main = sample (arbitrary :: Gen (Circuit Input))
main = do
- gen <- withSystemRandom . asGenIO $ return
- gr <- wattsStrogatzGraph gen 100 2 0.6
- runGraphviz (graphToDot nonClusteredParams (graphInfoToUGr gr)) Png "output.png"
+ gr <- (randomDAG 100 :: IO (Gr Gate ()))
+ runGraphviz (graphToDot quickParams $ emap (\_ -> "") gr) Png "output.png"