You end up with this chequerboard pattern:
Now you build your graph, defining its vertices and the edges connecting them. Put a vertex in each white zone, and above each crossing, draw an edge between the two neighbouring white zones, connecting the two vertices associated to them:
Once you've got your graph, you have to compare each crossing with the
two guides, the plain and the dashed one, to decide what type of crossing
it is:
or
You have to realize what are the effects of walls on the graph because
the graph you extract may well be awfull as is but with the aid of a few
walls here and there can be seen as snapped onto an easy grid. As you can
see in the following example, closing a door amounts to identifying the
two end points while slashing an edge is equivalent as simply discarding
that edge:
Let's build a bigger knot with the aid of encapsulation.