Deciding whether a graph can be drawn in one line and passing each edge only once is rather easy. One only needs to calculate the rank of each vertex and look whether there are at most two vertices with an odd rank.
Here there are two such vertices: A and E. These are the possibilities to being and end the strokes to build the graph.
The solution to the problem of drawing the house in one stroke ist done with a rule-based approach. The house itself is represented as a set of single-line strokes,. Beginning with a start configuration we define a rule how a line-stroke is added to the existing strokes
This rule is then applied as long as there are lines to draw left. A simple idea which works perfectly with the Mathematica-built in rule and pattern matching system. The result is a list of all 44 possibilities to draw this house in one stroke.
Download Notebook, PDF, Open Notebook in browser
Made in RapidWeaver