DAG with exactly k distinct paths from vertex 1 to n

Revision en1, by __baozii__, 2025-07-02 15:14:24

Introduction

This blog is inspired by this blog, which is an interesting constructive problem:

  • How to construct a DAG with no multiple edges, such that there exists exactly $$$k$$$ distinct paths from vertex $$$1$$$ to $$$n$$$?

Obviously, there is a trivial solution which requires $$$2k$$$ edges and $$$k+2$$$ vertices. Simply connect vertex $$$1$$$ to each vertex numbered from $$$2$$$ to $$$k+1$$$, then connect each of these vertices to vertex $$$k+2$$$. In this blog, we shall discuss how to minimise the number of edges used.

Task $$$1$$$: Using no more than $$$4 \log k$$$ edges

This is likely to be the first way that many people will approach this problem. Consider the following structure:

There are exactly $$$2$$$ distinct paths from $$$1$$$ to $$$3$$$. If we chain them together as such:

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English __baozii__ 2025-07-02 17:01:26 2 Tiny change: 'tion is $1101$, and we' -> 'tion is $1011$, and we'
en6 English __baozii__ 2025-07-02 15:53:37 0 (published)
en5 English __baozii__ 2025-07-02 15:53:19 2 Tiny change: 'up to $10^100$ in the o' -> 'up to $10^{100}$ in the o' (saved to drafts)
en4 English __baozii__ 2025-07-02 15:52:37 2 Tiny change: '$k \le 10^17$, and max' -> '$k \le 10^{17}$, and max'
en3 English __baozii__ 2025-07-02 15:51:26 1224 (published)
en2 English __baozii__ 2025-07-02 15:41:11 2255 Tiny change: 'g graph:\n[](/predown' -> 'g graph:\n\n![ ](/predown'
en1 English __baozii__ 2025-07-02 15:14:24 1036 Initial revision (saved to drafts)