How to use the graphlib/lib/alg.postorder function in graphlib

To help you get started, we’ve selected a few graphlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uzyn / web3-loader / index.js View on Github external
function sortByDependencies(compiledContracts) {
  var depsGraph = buildDependencyGraph(compiledContracts);
  var dependsOrdering = GraphAlgorithms.postorder(depsGraph, depsGraph.nodes());
  logDebug('Deployment order: ', dependsOrdering);
  compiledContracts.sort(function (a, b) {
    return dependsOrdering.indexOf(a.name) - dependsOrdering.indexOf(b.name);
  });
}