Interface ReadonlyNode

Hierarchy

  • ReadonlyNode

Implemented by

Properties

in: ReadonlyMap<ENFA.ReadonlyNode, null | CharSet>
out: ReadonlyMap<ENFA.ReadonlyNode, null | CharSet>

Methods

  • Returns a set of all nodes that are reachable from the given node by only following epsilon transitions in the given direction. The returned set is guaranteed to always contain the given node.

    The order of the nodes in the returned set in implementation-defined and cannot be relied upon.


    This method can be used to determine the set of all effectively final states.

    const effectivelyFinal = final.reachableViaEpsilon("in");
    

    Parameters

    • direction: "in" | "out"

    Returns Set<ENFA.ReadonlyNode>

  • Calls the given consumer function on every non-epsilon transition directly reachable from the given node.

    Epsilon transitions will be resolved using a DFS algorithm. This means that for the following graph:

    (0) -> (1) : "a"
        -> (2) : epsilon
        -> (3) : "b"
    
    (1) -> (3) : "c"
    
    (2) -> (4) : "d"
        -> (1) : "e"
        -> (2) : epsilon
    
    (3) -> (1) : epsilon
    
    (4) -> empty
    

    The node (0) will return the resolved list:

    [(1), "a"]
    [(4), "d"]
    [(1), "e"]
    [(3), "b"]
    

    Parameters

    Returns void