Git Product home page Git Product logo

Comments (3)

targos avatar targos commented on August 25, 2024

It is not trivial to do. There are references that cannot be serialized to JSON

from disjoint-set.

JeffersonH44 avatar JeffersonH44 commented on August 25, 2024

the most easiest way to me is adding an id to each disjointSetNode, with that we can get the same references for the parents, idk if you have a better idea @targos

from disjoint-set.

JeffersonH44 avatar JeffersonH44 commented on August 25, 2024

I think that the problem is more that we allow object values, I think that we should not treat them differently, for example:

var ds = new DisjointSet();
var obj1 = {};
var obj2 = {};

var node1 = ds.add(obj1);
var node2 = ds.add(obj2);

node1 === node2 // this should be true

I think that the main idea of this kind of structures is for searching by the whole object instead of references, right?

I think that we have two solutions:

  • provide a method for deep equal with objects (I think that's not easy)
  • not allowing the user to add objects.

idk what you think @targos. (maybe I'm too crazy, lol)

from disjoint-set.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.