datavis-tech / graph-data-structure

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

Topological sort type doesn't allow for not passing in a source node #49

Closed CrispyBacon1999 closed 3 years ago

CrispyBacon1999 commented 3 years ago

In the index.d.ts file, topologicalSort is defined with sourceNodes: NodeId[], which doesn't allow for not passing in any source nodes. This makes following the examples impossible, and as far as I can tell, there's no easy way to actually make it run without the source nodes being passed in without chaning the index.d.ts to be sourceNodes?[]

curran commented 3 years ago

Oh interesting! Sorry about that.

Would you be open to contributing a change to the type definitions to allow for this case?

CrispyBacon1999 commented 3 years ago

For sure, just put in #50, which should fix it.