LeetCode 928: Minimize Malware Spread II
Misleading type alias
You are using uint16 = std::uint_fast16_t, but if I see the name uint16, as a programmer I assume this is identical to uint16_t. But uint16_t and uint_fast16_t might have very different properties, so therefore it is a potentially misleading name.
When you create a type alias, you usually want to give it a name that conveys its intent. Here, it's to hold sizes and indices. So I would recommed using size_type = ... instead.
Name functions after their intent, not their implementation
The function breadthFirstSearch() indeed uses a BFS algorithm internally, but the intent of this function is to return the number of infected nodes given a set of initial infectations and an excluded node. So name it something like countInfectedNodes() instead.
While you are at it, rename node in that function to excluded_node, to make it clear what its purpose is.
Use a std::vector&lt;bool&gt; to keep track of infected nodes
A bitset is much more compact and faster than a std::set in this case, since nodes are just numbers between zero and std::size(graph). However, you can't use std::bitset here because that needs the size to be known at compiletime. Instead, this is one of the few occasions where a std::vector&lt;bool&gt; is useful:
std::vector&lt;bool&gt; nodes_set(std::size(graph));
nodes_set[excluded_node] = true;
...

Avoid modifying the input parameters
While the LeetCode problem does state that the parameters are non-const, it is nevertheless bad practice to modify the input parameters if it's not expected that this will happen.
You can avoid sorting initial, by just modifying the way you set smallest_node:
if (curr_len &lt; min_len || (curr_len == min_len &amp;&amp; init_node &lt; smallest_node)) {
    min_len = curr_len;
    smallest_node = init_node;
}

Consider stopping counting infections if it won't improve the minimum
Currently, for every candidate node to remove, you count all infections. However, if halfway you notice that you are already above the minimum seen so far, then you can stop early. Just pass the previous min_len to countInfectedNodes() and check it when incrementing count:
static size_type countInfectedNodes(
    const std::vector&lt;std::vector&lt;int&gt;&gt;&amp; graph,
    std::vector&lt;int&gt;&amp; initial,
    size_type excluded_node,
    size_type current_min,
) {
    ...
        nodes_set[curr_node] = true;
        if (++count &gt; current_min) {
            break;
        }
    ...
}