Skip to content

Unecessary O(n*m) state generation #3

@ExpHP

Description

@ExpHP

intersectNFAs currently generates O(N*M) states and then does a breadth first search to cull states that are unreachable from the start. However, it is easy enough to integrate the breadth first search into state generation so that we only ever generate reachable states to begin with.

I did this in my (unpublished) conversion to Rust, and can work on a patch for this package if you'd like.


Here's a gist of what I did in rust. The loop body really hasn't changed, only the logic for iteration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions