I'm sorry about my poor English.
First, make every cross a node. Give each node a position $$$(x, y)$$$. There is an edge between two nodes if and only if:
- $$$|x_1-x_2|+|y_1-y_2|=1$$$ - The edge splits two different characters.
For example, for the example situation in the problem.
We will get the graph: