How to use 'python disjoint set' in Python

Every line of 'python disjoint set' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
6def testUnionFind(self):
7 ds = DisjointSet(range(100))
8 for i in range(100):
9 ds.union(i, i % 5)
10 for i in range(100):
11 for j in range(i, 100):
12 self.assertEqual(ds.find_set(i) == ds.find_set(j), i%5 ==j%5)

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

Related snippets