Note: I originally posed this question to Mathematics, but it was recommended that I try here as well.
For context, this problem is part of my attempt to determine the path of least inertia for a free and open-source laser scanner DAC API I am developing. The following problem arises during the vector image optimisation pass. I convert the 2D vector image into a graph of 2D positions and add blank edges (i.e. transparent lines) to represent the image as a strongly connected, undirected Eulerian graph from which I should be able to determine the optimal Eulerian circuit.
Given a strongly connected, undirected Eulerian graph (i.e. each vertex has an even degree), I'm trying to determine the Eulerian circuit that results in the minimum possible accumulative angular distance, where each vertex is a position in 2D space and each edge describes a straight line between the vertices.
My Solution Attempt
Edit: Since posting, I've since realised that my solution attempt is incorrect as the resulting traversal is not guaranteed to form a Eulerian circuit. Feel free to skip this section and the My Solution Attempt Issues section.
My attempt at solving this was to first simplify the problem by looking at each vertex individually. We know that each vertex must have an even degree, and thus for each vertex there must be an optimal set of incoming/outgoing edge pairs (where each edge is used once) that results in a minimum accumulative angular distance. By minimum accumulative angular distance, I'm referring to the sum of the difference between the result of the difference between the angle of each incoming/outgoing edge pair and a straight line. For example, given the following vertex A and its neighbours B, C, D and E:
an example of optimal pairs would be (DA, AB) and (EA, AC) as they are cumulatively the least sharp angles through which A may be traversed (and in turn would induce the least inertia), whereas the pairs (EA, AD) and (BA, AC) would be the least optimal as cumulatively they contain the sharpest angles to be traversed (resulting in the highest inertia).
Once the set of optimal pairs is determined for each vertex, I suspect the Eulerian Circuit can be created by starting at one of the vertices, picking a direction to begin and following the optimal pairs until the beginning is reached again.
My Solution Attempt Issues
Currently however I'm running into two issues.
- I don't know for sure whether or not my assumption holds true for all Euler graphs (where all nodes have an even degree).
- I'm unsure of the best approach for determining the set of optimal edge pairs for each vertex. I suspect it may be possible to represent each vertex and its edges as a sub-graph and treat the problem as finding the shortest path (where the "shorter" distances are the paths through the vertex that result in the straightest angles), but I'm struggling to come up with a sub-graph representation that would allow me to do this.
In section 3.4 of Accurate and Efficient Drawing Method for Laser Projection the paper describes using Hierholzer’s algorithm for finding an optimal Eulerian circuit with the amendment that during traversal of each vertex you select the unvisited edge along the angle closest to a straight line. One issue that occurs to me with this approach is that it is not clear to me that this always results in the absolute optimal circuit, only one that is probably more optimal than a naive construction without this added amendment.
- Is there an existing solution to the original Problem stated above? If so, is there somewhere I might read further on this?
If not, does my attempted solution sound like a reasonable approach? If so, do you have an idea of how I might represent the sub-graph for determining the set of edge pairs resulting in the minimum accumulative angular distance for each vertex?Approach determined to be invalid.
- If not, can you recommend an approach I might be able to take to make progress on solving the previously mentioned Problem?
Any advice appreciated!