Class Node

Hierarchy

  • Node

Implements

Constructors

Properties

in: Map<ENFA.Node, null | CharSet> = ...
out: Map<ENFA.Node, null | CharSet> = ...

Methods

  • Adds a transition from this to to using the given non-empty set of characters.

    If two nodes are already linked, an error will be thrown.

    Parameters

    Returns void

  • 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.Node>

  • 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

  • Removes the transition from this to to.

    This will do nothing if this isn't linked to to.

    Parameters

    Returns void

  • Unlinks all outgoing and incoming transitions of this node.

    Returns void

  • Unlinks all incoming transitions of this node.

    Returns void

  • Unlinks all outgoing transitions of this node.

    Returns void