The following colouring algorithm can be used to determine whether a connected graph is bipartite or not. The algorithm colours each vertex of a graph in one of two colours, α and β.
STEP 1 Choose a vertex and assign it colour α.
STEP 2 If any vertex is adjacent to another vertex of the same colour, jump to STEP 5. Otherwise assign colour β to each vertex that is adjacent to a vertex with colour α.
STEP 3 If any vertex is adjacent to another vertex of the same colour, jump to STEP 5. Otherwise assign colour α to each vertex that is adjacent to a vertex with colour β.
STEP 4 Repeat STEP 2 and STEP 3 until all vertices are coloured.
STEP 5 If there are no adjacent vertices of the same colour then the graph is bipartite. Otherwise the graph is not bipartite.
STEP 6 Stop.
Apply this algorithm to graph A, starting with the vertex in the top left corner, to determine
whether graph A is bipartite or not.