Advertisement
Guest User

Untitled

a guest
Jul 27th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 1.19 KB | None | 0 0
  1. [<Test>]
  2. let SmallGraph () =
  3.     let x = new InitialNode()
  4.     let y = new InitialNode()
  5.  
  6.     let terminal = new TerminalNode()
  7.  
  8.     let plus = new AddNode()
  9.     let less = new LtNode()
  10.     let multiplexor = new MultiplexorNode()
  11.  
  12.     x.AddNewInPort()
  13.     y.AddNewInPort()
  14.  
  15.     terminal.AddNewOutPort()
  16.  
  17.     let vsfg = new VSFG ([|x; y|], [|terminal|])
  18.     let f = new NestedVsfgNode (vsfg)
  19.  
  20.     VSFG.AddVerticesAndEdges
  21.         [|
  22.             x :> Node, 0, plus :> Node, 0;
  23.             y :> Node, 0, plus :> Node, 1;
  24.             x :> Node, 0, less :> Node, 0;
  25.             y :> Node, 0, less :> Node, 1;
  26.  
  27.             x :> Node, 0, f :> Node, 0;
  28.             y :> Node, 0, f :> Node, 1;
  29.  
  30.             less :> Node, 0, multiplexor :> Node, 0;
  31.             f :> Node, 0, multiplexor :> Node, 1;
  32.             //plus :> Node, 0, multiplexor :> Node, 1;
  33.             plus :> Node, 0, multiplexor :> Node, 2;
  34.  
  35.             multiplexor :> Node, 0, terminal :> Node, 0;
  36.         |]
  37.  
  38.     checkNeighbours x 1 3
  39.     checkNeighbours y 1 3
  40.     checkNeighbours terminal 1 1
  41.     checkNeighbours plus 2 1
  42.     checkNeighbours less 2 1
  43.     checkNeighbours f 2 1
  44.     checkNeighbours multiplexor 3 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement