# Revision history [back]

Hi there,

I wonder how I can use Sage to solve the following problem, without implementing a full-blown backtracking. Given a set X of 2k distinct vertices $s_1,...,s_k,t_1,...,t_k$ of a (small) graph G and arbitrary k pairs $(s_i,t_i)$, find k pairwise vertex-disjoint $s_i-t_i$ paths.

Thank you in advance, and regards, Guillermo

Hi there,

I wonder how I can use Sage to solve the following problem, without implementing a full-blown backtracking. Given

Let $G$ be an undirected simple graph with at least $2k$ vertices. The graph $G$ would need to be $2k-1$-vertex-connected for the problem to hope to have a solution, but this is perhaps beside the point. Let $X$ be a set X of 2k $2k$ distinct vertices $s_1,...,s_k,t_1,...,t_k$ of a (small) graph G and arbitrary G. Pair these $2k$ vertices arbitrarily into k pairs $(s_i,t_i)$, find $(s_i,t_i)$. The pair $(s_i,t_i)$ means that the vertex $s_i$ has been paired with the vertex $t_i$. This pairing doesn't altered the graph $G$ in any way. The problem consists of finding k pairwise vertex-disjoint $s_i-t_i$ paths.paths between $s_i$ and $t_i$ for each i, or returns that it is not possible to do so.

A graph for which you can find the $k$ vertex-disjoint paths for any possible set $X$ is called $k$-linked.

Let me give you an example. Suppose I take the 3-cube graph. I am gonna see it as a graph of the polytope 3-cube because the image is better.

P3=polytopes.hypercube(3)

Q3=P3.graph()

Q3.show()

Let me choose 4 vertices arbitrary vertices for my set $X$, say $s_1=(1,1,1)$, $t_1=(-1,-1,1)$, $s_2=(1,-1,1)$ and $t_2=(-1,1,1)$. Pair the vertices as $(s_i,t_i)$. Then we cannot find 2 vertex-disjoint paths, one connecting $s_1$ to $t_1$ and another $s_2$ to $t_2$. However, if I choose $X$ to be $s_1=(1,1,1)$, $t_1=(-1,-1,1)$ and $s_2=(-1,-1,-1)$ and $t_2=(1,1,-1)$ we can.

As an aside this shows that the 3-CubeGraph is not 2-linked.

Hope this is a bit clearer now.

Thank you in advance, and regards, Guillermo Guillermo