מבני נתונים ואלגוריתמים - מחברת קורס/גרפים/אלגוריתם Union-Find/דוגמה לשימוש באלגוריתם המקורי

מתוך ויקיספר, אוסף הספרים והמדריכים החופשי
1	Sets = Connected-Components(G)

	# Prints True.
1	Print( Find-Set(Sets[1]) == Find-Set([3]) )

	# Prints False.
2	Print( Find-Set(Sets[2]) == Find-Set([3]) )