Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the algorithm for generating a random Deterministic Finite Automata?
    primarykey
    data
    text
    <p>The DFA must have the following four properties:</p> <ul> <li><p>The DFA has N nodes</p></li> <li><p>Each node has 2 outgoing transitions.</p></li> <li><p>Each node is reachable from every other node.</p></li> <li><p>The DFA is chosen with perfectly uniform randomness from all possibilities</p></li> </ul> <p>This is what I have so far:</p> <ol> <li>Start with a collection of N nodes.</li> <li>Choose a node that has not already been chosen.</li> <li>Connect its output to 2 other randomly selected nodes</li> <li>Label one transition 1 and the other transition 0.</li> <li>Go to 2, unless all nodes have been chosen.</li> <li>Determine if there is a node with no incoming connections.</li> <li>If so, steal an incoming connection from a node with more than 1 incoming connection.</li> <li>Go to 6, unless there are no nodes with no incoming connections</li> </ol> <p>However, this is algorithm is not correct. Consider the graph where node 1 has its two connections going to node 2 (and vice versa), while node 3 has its two connection going to node 4 (and vice versa). That is something like:</p> <p>1 &lt;==> 2</p> <p>3 &lt;==> 4</p> <p>Where, by &lt;==> I mean two outgoing connections both ways (so a total of 4 connections). This seems to form 2 cliques, which means that not every state is reachable from every other state.</p> <p>Does anyone know how to complete the algorithm? Or, does anyone know another algorithm? I seem to vaguely recall that a binary tree can be used to construct this, but I am not sure about that.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload