Finite state machines: flip-flop
JK flip-flop:
q J K q+ z  
State: 1 bit (q) 0 0 0 0 0 hold
Input: 2 bits (JK) 0 0 1 0 0 reset
Output: current state (z) 0 1 0 1 0 set
0 1 1 1 0 toggle
1 0 0 1 1 hold
1 0 1 0 1 reset
1 1 0 1 1 set
1 1 1 0 1 toggle
Input is 2 bits, so there are 4 outgoing arcs from each state, but 2 pairs are equivalent
This can be implemented with either a T or D flip-flop