The superficial connection between this pericope and the preceding one is that they both contain parables about prayer. [source][source][source]
"This parable follows as giving the spirit in which men should pray." [1][source]
However the more significant link is the people of faith ( Luke 18:8). This parable graphically contrasts those who reject Jesus" gospel with those who receive it. Jesus drew a verbal picture to identify the characteristic traits of two representative groups of Jews. Both parables deal with righteousness: the unrighteous judge in the first one, and the self-righteous Pharisee in the second. [source][source][source]