Beta

Are these nodes connected?

Description
Loading description...
Data Structures
Algorithms
Graph Theory
  • Please sign in or sign up to leave a comment.
  • G_kuldeep Avatar

    Duplicate to at least 10 kata

  • trashy_incel Avatar

    I added random tests to this kata, please refer to me if something is broken. If everything is fine i think this kata is valid for approval.

  • myjinxin2015 Avatar

    I puts these code to the example test block and it works, why I got error when I submit?

    var nodes = new Nodes(10); // why you did not use new?(in your description)
    nodes.connect(0,1); 
    nodes.connect(1,2);
    describe("Solution", function(){
      it("should test for something", function(){
        Test.assertEquals(nodes.isConnected(0,2), true);
      });
    });
    
    • SimplGy Avatar

      The full test suite tests a set of 10 nodes, with more complex connections, so you could pass for a simple 0,1,2 case but fail for something more tricky. Check your work!

      new is not necessary, and sometimes not desired. I did not build Node so that it requires the new operator.

    • trashy_incel Avatar

      Marking as resolved since the author managed to solve the kata

      Question marked resolved by trashy_incel 5 years ago
  • AzariasB Avatar

    Some more tests are neede (look at my solution !!) And a test example would be nice too

  • Austin Haws Avatar

    An example test case would be nice. There is a good example in the description, just copy that to the example tests. Could use some more tests for the submit including some random ones. What should it do about infinite loops? connect(1, 2); connect(2, 1); isConnected(1, 3); and other edge cases? The example shows 10 nodes being created and then it references node 0. Are the nodes zero based or does Node(10) mean the largest index is 10 (ie nodes 0->10)? Cool concept. Fun Kata. Thanks!