How do you regain flexibility of the knee joints following a broken leg?

Physical therapy. Structured exercises, which you can learn from a physical therapist.