Questions tagged [disjoint-sets]

Anything related to disjoint sets, i.e. mathematical sets that have no element in common.

Anything related to disjoint sets, i.e. mathematical sets that have no element in common.

194 questions
1
vote
1 answer

Best-case performance of disjoint set forests, and proving lower bounds of algorithms

There is a question on an assignment that was due today which solutions have been released for, and I don't understand the correct answer. The question deals with best-case performance of disjoint sets in the form of disjoint set forests that…
dmkc
  • 1,161
  • 1
  • 15
  • 22
1
vote
1 answer

Do we need both path compression and union by rank together in disjoint set data structure?

I was studying disjoint set data structure. I studied path compression and union by rank. Initially all the elements are single in their own set and by performing unions we can combine different sets. Now since we are performing union by rank the…
user6575289
1
vote
0 answers

Codechef GALACTIK solution

Here's the link for the problem: I have used union-find algorithm to solve the problem. Code: #include using namespace std; typedef long long int ll; #define INT 100000000 unordered_map parent; unordered_map
1
vote
1 answer

Which approach is best Bfs or Dfs or Disjoint set for finding all disconnected graphs

Which approach should we use to find all disconnected graphs and why ? As BFS and DFS traversal both are traversal methods and by multiple traversals. We can find all disconnected components. And another approach can be Disjoint Sets as used in…
1
vote
1 answer

Why is the running time of disjoint-sets calculated in terms of number of operations instead of size of input?

CLRS says "we shall analyze the running time of disjoint-set in terms of two parameters: n, the number of MAKE-SET operations m, the total number of MAKE-SET, UNION and FIND-SET operations" Why is this different from most analyzations of other…
Rajesh
  • 336
  • 3
  • 13
1
vote
2 answers

how does kruskal's algorithm's performance gets affected by the disjoint set data structure?

I've got a basic idea on what Kruskal's algorithm is and this is what I discovered: This algorithm basically constructs a minimal spanning tree by merging multiple trees and it begins by sorting the edges by their weights. Beginning with an empty…
1
vote
1 answer

Kruskal Algorithm implemenation

I found a tutorial that created the makes and finds methods as such public void makeSet(long data) { Node node = new Node(); node.data = data; node.parent = node; node.rank = 0; map.put(data, node); …
user4332856
1
vote
1 answer

Disjoint Paths Algorithm

What is the simplest way to count find augmenting paths? Counting Edge-Disjoint Paths Using Labeling Traversal to Find Augmenting Paths def paths(G, s, t): # Edge-disjoint path coun H, M, count = tr(G), set(), 0 …
user6009583
1
vote
1 answer

Understanding boost::disjoint_sets_with_storage

I try to understand boost::disjoint_sets_with_storage but even the simplest example possible doesn't work and I can't understand why. #include int main(){ boost::disjoint_sets_with_storage<> union_find; …
François
  • 471
  • 1
  • 4
  • 10
1
vote
1 answer

Find set with path compression without union by rank

If I have n single node trees and m find set operations (note: no unions, assuming unions have been done before) and use path compression only, is it true that this takes O(m) time? I've been trying to prove this but it doesn't seem that it is the…
1
vote
0 answers

Disjoint set as greedy solution

For scheduling jobs with given deadlines and profits on prompt completion,a greedy algorithm is suggested to maximize profits from all feasible sets of task. However,the programmatic implementation recommended is disjoint set forests. I have not…
IUnknown
  • 9,301
  • 15
  • 50
  • 76
1
vote
1 answer

Boost disjoint set

I need to make a disjoint set of the type dataum. I have all the data in the vector as follows vector S; S.push_back( dataum(0,0) ); S.push_back( dataum(0,1) ); S.push_back( dataum(0,2) ); . . Then I create the disjoint_set…
mkuse
  • 2,250
  • 4
  • 32
  • 61
1
vote
1 answer

Incrementally find number of disjoint sets in reduced graph

I find the number of disjoint sets in a graph G and then I delete some vertices of graph G and make graph G', and I want to find the number of disjoint sets in G', is there any good algorithm for that without doing the same thing to G' as we did to…
user3105226
  • 43
  • 1
  • 2
  • 7
1
vote
1 answer

cycle detection in undirected graph using disjointsets?

I am implementing the code for cycle detection in undirected graph using find/union methods of disjointsets. Here is the implementation: public boolean isCyclicundirected(){ int k; ArrayDisjointSet set = new ArrayDisjointSet(5); …
brain storm
  • 30,124
  • 69
  • 225
  • 393
1
vote
3 answers

Disjoint sets data structures and binomial trees?

Can someone either explain what Disjoint Sets Data Structure is?, or alternatively link me to a YouTube video or article that explains it well. I searched for it a few minutes ago and all I got were some Math lessons that involved an image that…
Austin
  • 3,010
  • 23
  • 62
  • 97