New answers tagged

0 votes

NP-hardness of modified distance-colouring of graphs

The problem you describe (for $r=1$) falls under the so-called $[\sigma,\rho]$-partitioning framework with several hardness results available (see e.g., [1]). In such a problem, we want to color the ...
Juho's user avatar
  • 22.5k
0 votes

Trying to implement BFS and I am stuck

Every tree is also a graph. Therefore, you can use breadth-first search directly on a tree. It doesn't require recursion; you can use a queue and a loop. As soon as you encounter a node that ...
D.W.'s user avatar
  • 156k
0 votes

NP-hardness of modified distance-colouring of graphs

I don't have an answer to your problem, but I have an answer for a different problem. Let the Annotated Colorful Neighborhood-problem be as follows. Annotated 2-Colorful 1-Neighborhood Input: $G = (V, ...
Pål GD's user avatar
  • 15.5k
0 votes

Trying to implement BFS and I am stuck

The pseudo code for DFS using recursion would look something like this: ...
Amirreza Hashemi's user avatar
0 votes

fastest algorithm to count leaf nodes (i.e. terminal nodes)

Store the tree in an array $A$ so that $A_i$ contains the index of the parent's node. For example: A = [-1 0 1 1] would be a four-node-tree where the root node has ...
Stand with Gaza's user avatar

Top 50 recent answers are included