Code Monkey home page Code Monkey logo

shortest-way's Introduction

Hi there ๐Ÿ‘‹

Hi, I have over 17 years of experience in software craftmanship. I have designed, developped and maintained several architecture such as back-end, fullstack, front-end and many others. Since 2022, I teach Green-IT best practices to DevOps teams.

๐™ˆ๐™ฎ ๐™Ž๐™š๐™ง๐™ซ๐™ž๐™˜๐™š๐™จ

๐Ÿ”„ end to end building of the digital solution that fits your need, ๐Ÿ‘จโ€๐Ÿ’ป perfect codes that fit your needs, ๐Ÿ‘จโ€๐Ÿซ Green-IT and sustainable development trainings for your DevOps teams and managers.

๐™ˆ๐™ฎ ๐™™๐™š๐™ก๐™ž๐™ซ๐™š๐™ง๐™–๐™—๐™ก๐™š๐™จ

โœ… ๐Ÿงชthe test coverage of all business scenarios and other exceptionals ones, โœ… ๐Ÿš€the performance in term of execution time and velocity, โœ… ๐Ÿ•ต๏ธthe security โœ… โ™ฟthe accessibility โœ… ๐ŸŒฑand sobriety to reduce the impact of digital technology on our environment.

๐Ÿ“ฉ Do not hesitate to contact me, it is free, and in any case I will advise you about your needs.

Connect with me

linked-in



Expertises

greenit



java

spring

nodejs

javascript

typescript



rust



And much more :

  • SQL
  • Agility
  • Tests
  • Reliability
  • ...

What to find here ๐Ÿง

  • lots of sandboxes and playground to lear a technology
  • Some open sources projects pinned bellow.


shortest-way's People

Contributors

corentinway avatar

Watchers

 avatar  avatar

shortest-way's Issues

Impossible routes do not look that way

An impossible route should be distinguishable from a possible one. If this is achieved by an exception (which one would have to catch) or by an explicit error return (like ยดnull`) or just an empty array, is not important but it should do one of those.

Right now, this happens, note that the two nodes are NOT connected intentionally:

var Node = require( 'shortest-way' ).Node;

// create nodes
var n1 = new Node( { id: 'n1' } );
var n2 = new Node( { id: 'n2' } );

var path = n1.compute(n2, [n1, n2]);
console.log(path.map(function (item,index) {return index + ': ' + item.id;}).join("\n"));

expected result
null or [] or some kind of Exception

actual result
0: n1
1: n2

The printed result is indistinguishable from a connected graph, as far as I can tell.

Return-path not possible automatically?

Is it intentional, that A -> B does not automatically mean B -> A? If so, is there a convenience function to set the pairs up automatically? Also the output (provided at the end) seems to be wrong?

var Node = require( 'shortest-way' ).Node;

// create nodes 
var nodes = {
	startNode: new Node( { id: 'startNode' } ),
	middleNode1: new Node( { id: 'middleNode1' } ),
	middleNode2: new Node( { id: 'middleNode2' } ),
	middleNode3: new Node( { id: 'middleNode3' } ),
	endNode: new Node( { id: 'endNode' } )
};

// add relation
nodes.startNode.addNext(nodes.middleNode1, 1.9);
nodes.startNode.addNext(nodes.middleNode2, 1.7);
nodes.middleNode1.addNext(nodes.endNode, 1);
nodes.middleNode2.addNext(nodes.middleNode3, 0.01);
nodes.middleNode3.addNext(nodes.endNode, 1);

// Test 1: array!
console.log("from array\n=====================");
var pathFromArray = nodes.endNode.compute(nodes.startNode, [nodes.startNode, nodes.middleNode1, nodes.middleNode2, nodes.middleNode3, nodes.endNode]);
console.log(pathFromArray.map(function (item,index) {return index + ': ' + item.id;}).join("\n"));

// Test 2: object!
console.log("\nfrom object\n=====================");
var pathFromObject = nodes.endNode.compute(nodes.startNode, nodes);
console.log(pathFromObject.map(function (item,index) {return index + ': ' + item.id;}).join("\n"));

expected output:
0: endNode
1: middleNode3
2: middleNode2
3: startNode

actual output:
0: endNode
1: startNode

So, as you can see, the actual output from shortest-way is not only not the expected result, it's the same result as if there was no actual path (which currently is not reported either, but this is a question for #2 )

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.