Arithmagons on graphs

56 Views Asked by At

Arithmagons are polygons with a hidden number on each vertex and a given number on each side such that each given number is the sum of the two hidden numbers adjacent to it. These are well-known tasks for primary school.

enter image description here

It is known that for simple (isomorphic to regular) polygons there is always a unique solution when the number of sides is odd. If the number of sides is even, there are infinitely many solutions provided that the alternating sum of the edges is 0; otherwise there are no solutions.

In the book "Thinking mathematically" authors suggest to consider polygons with "a more general arrangement of vertices", in fact a networks or graphs:

enter image description here

Is there really a finite algorithm that allows any such graph problem to answer whether a solution exists or not. And if there is, determine one of them. It is clear from the context that the analysis of system of the linear equations is not assumed.

1

There are 1 best solutions below

2
On BEST ANSWER

To begin with, we can assume that the graph is connected; if it is not, we should try to solve each connected component separately. With that in mind, the biggest distinction is already there in the polygon case. We want to know: does the graph contain an odd cycle?

If so, then there is a unique solution for the vertices of that cycle, taking just the cycle's edges into account. Once we have that solution, we can propagate it: for as long as there's an edge $uv$ where $u$ has been given a number but $v$ has not, we can identify a unique value for $v$ to satisfy $uv$'s sum constraint. Finally, once all vertices are labeled, we can check whether all the edge constraints we haven't used yet are satisfied. If they are, we've found the unique soltuion; if they are not, no solution exists.

On the other hand, if the graph has no odd cycles, then it is bipartite: we can find a partition $A \cup B$ of its vertices such that all edges join a vertex in $A$ to a vertex in $B$. In this case, if we have one solution, we get an infinite family of solutions: we get more by increasing the label of every vertex in $A$ by a constant, then decreasing the label of every vertex in $B$ by the same constant.

So in the bipartite case, we are looking for an infinite family of solutions. To find it, pick an arbitrary vertex, and label it with a variable $x$. Then, propagate as before, except that the label we give every other vertex will be a function of $x$. (Specifically, every other vertex will get a label of the form $a+x$ or $a-x$ for some constant $a$.) Again, once we have labeled every vertex, check all the unused edge constraints to make sure that they're satisfied: this will tell us if we have infinitely many solutions or none.