[Math] Minimum number of k length paths over n vertices

graph theory

(excuse my lack of Math Theory)

I have $N$ number of vertices and can make paths of up to $K$ length. How do I figure out the minimum number of paths to form the complete graph of $N$ vertices.

What is a complete graph?

A complete graph is $N$ vertices that each vertex had $N-1$ connections (all vertices connect to all other vertices).

if you are on any vertex of a complete graph, where (to how many vertices) can you go in one step?

If it's complete, there is no need to transverse to another vertex. Since all vertices can connect to all other vertices each path between them has a value of one. In other words $N$ vertices connected is a path of $N-1$ length.

if you have a path, can you repeat vertices? Why?

Maybe you meant repeat path lengths? It's not issue in my environment as I can transverse the same path lengths any number of times without any penalty, but in doing so still uses a length of $K$.

In Reality

I'm a programmer so I actually have to come up with a way to do this for a real world solution. I would start with $N$ vertices each with $0$ connections (paths to each vertex) and the value of $K$. A solution I thought of would look like:

In a repeating looping (until $N$ vertices all had $N-1$ connections)

I would first choose a vertex with the least number of connections, I'll call it vertex $A$.

Next I would find the next vertex with the least number of connections where this vertex has no previous connection with, I'll call it vertex $B$.

Create a path between $A$ and $B$.

In a secondary loop (of $K-1$ times):

Select $A$ or $B$ whichever has the least number of connections as $X$.

Find $Y$ where $Y$ has not been connected to $X$. Create a path Between $X$ and $Y$. $Y$ replaces (the selected $A$ or $B$).

If $Y$ is not found, find any vertex $Y$ where $Y$'s connections is less than $N-1$) Create a duplicate path between $X$ and $Y$. $Y$ replaces (the selected $A$ or $B$).

If $Y$ is not found, we are done.

End of second loop and first loop.

This will most likely work, however I'm sure there has to be a formula to give me an actual value.

Best Answer

As there are $\frac{(N-1)(N-2)}{2}$ edges in the complete graph and each of your paths can cover $K$ edges, the number $m$ of paths must be $\ge \frac{(N-1)(N-2)}{2K}$. If $N$ is odd, this is easily achieved by an Eulerian path cut into pieces of length $K$. If $N$ is even, a similar aproach is possible.

Related Question