datavis-tech / graph-data-structure

A graph data structure with topological sort and shortest path algorithms.
MIT License
249 stars 46 forks source link

Optimize hasEdge #48

Closed curran closed 3 years ago

curran commented 3 years ago

This should be a more efficient implementation, as it can be assumed that the implementation of includes returns early when the first match is found.

Uses: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes

The downside is that this is not compatible with Internet Explorer. But I think that's OK.