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
0
votes
1 answer

Disjoint set and maze creation

I am attempting to create a maze using a premade Disjoint set class. I have created a Cell class that contains a boolean variable for each of the four walls. The problem is, how do I create a disjoint set of cell objects? That way I can union the…
fluteman24
  • 33
  • 1
  • 5
0
votes
0 answers

Initialization of disjoint sets in python

I have some part of codes about disjoint sets. import set import copy """ Importing set.py should provide the following functions: set.Initialize(Values) -- return a new set system with one element per set. …
gcaur
  • 29
  • 4
0
votes
2 answers

Initialising a disjoint set using a for-loop in a dict constructor in Python

Firstly, I've mostly done very trivial things with python, so I am not very comfortable with pythonic syntax. I am learning about disjoint sets, and have a basic understanding of the implementation. I came across a python forest-implementation (not …
moomin
  • 49
  • 6
0
votes
0 answers

Money Matters uVA 11690 gives "Wrong Answer" and "Time Limit Exceeded" after multiple tries

Here is the link to the problem: prob https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2737 Following is my implementation. I tried their sample test case and multiple others and they all give the…
blehadfas1
  • 315
  • 1
  • 5
  • 13
0
votes
1 answer

Null Pointer Excpetion In DisjSet Maze Builder and can't figure out why

I'm trying to build a maze using a DisjSet algorithm. I feel like I've got it down but for some reason I can't figure out why I keep getting this null pointer exception in one of the classes I'm using. Any help will be appreciated This is the Maze…
0
votes
0 answers

connect subgraphs in optimal way

How can i connect two graphs by a bridge(link) in an optimal way? There are some criteria such as weight of each link, stability of link (connection quality), expected time for connection, etc. I am wondering how I can define a cost function based…
0
votes
2 answers

select from list B k distinct elements that are not in list A in python?

Suppose unordered listA = [1 2 3] s.t all elements distinct and unordered listB = [1 2 3 4 5] s.t all elements distinct original question was: How do i choose len(listA) times, elements of listB that, are NOT in listA and are distinct from…
jsky
  • 2,225
  • 5
  • 38
  • 54
0
votes
0 answers

C++ Disjoint Set Implementation with Doubly Linked Lists

Can someone help me find/make/point me in the right direction of a disjoint set implementation using Doubly Linked Lists? I have some supplemental code and I've already started editing it, I was wondering if someone could help me fill the rest in or…
Matt6500
  • 11
  • 1
  • 2
0
votes
1 answer

boost disjoint interval sets

I'm trying to use boost:disjoint_sets for non overlaping intervals (in my case the intervals in a set must have no intersection between its members) that are represented by the following struct: struct dataum { int x,y; bool operator< (const…
0
votes
1 answer

Connecting disjoint sets in a 2D array

I am trying to generate a random grid with positions that are Traversable and Non-Traversable and ensure that there is a path from one Traversable position to any other Traversable position in one of the 4 directions {Right, Up, Left, Down}.…
hededo
  • 371
  • 2
  • 16
0
votes
1 answer

Prove that any algorithm for solving disjoint sets takes at least nlog n

Disjoint sets problem Let A and B be two sets , are they disjoint ? Question Prove that any algorithm for solving disjoint sets takes at least O(nlog n). The idea I thought about is to prove that sorting can be reduced to disjoint set problem.…
Zaid Alyafeai
  • 155
  • 1
  • 13
0
votes
1 answer

Implementing Disjoint Set Data Structure in Python

I'm working on a small project involving cluster, and I think the code given here https://www.ics.uci.edu/~eppstein/PADS/UnionFind.py might be a good starting point for my work. However, I have come across a few difficulties implementing it to my…
Physicist
  • 2,848
  • 8
  • 33
  • 62
0
votes
1 answer

Some questions regarding implementing Disjoint Set data structure in python

So I just used the code available here: http://www.ics.uci.edu/~eppstein/PADS/UnionFind.py, but I have come across some problems about the code: First of all, what does the method iter mean or do? Second, suppose I originally have the following…
Physicist
  • 2,848
  • 8
  • 33
  • 62
0
votes
1 answer

How to get list of all elements from a 'Disjoint Sets'

In my problem, I have a bunch of Elements (Class Element). Say I have 1000 Elements. These Elements are initially un-associated which means they are in their own sets. Later I need to use the union operation to merge some of these sets based of my…
mkuse
  • 2,250
  • 4
  • 32
  • 61
0
votes
0 answers

boost - get components multigraph from disjoint set

I'm new in boost library. I have created a disjoint set structure on a graph to have some partitions on it, what is the best way to obtain the multigraph of the set components?
Cattani Simone
  • 1,168
  • 4
  • 12
  • 30
1 2 3
12
13