Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. SystemJS.config({
  2. packages: {
  3. app: {
  4. main: './app.js',
  5. defaultExtension: 'js'
  6. },
  7. 'bipartite-graph': {
  8. main: './bipartite-graph.js',
  9. defaultExtension: 'js'
  10. },
  11. 'rxjs': {
  12. defaultExtension: 'js'
  13. }
  14. },
  15. map: {
  16. app: 'app',
  17.  
  18. 'rxjs': 'node_modules/rxjs',
  19.  
  20. 'bipartite-graph': 'app/bipartite-graph'
  21. }
  22. });
  23.  
  24. import { Subject } from 'rxjs/Subject';
  25. import BipartiteGraph from 'bipartite-graph';
  26.  
  27. let subject: Subject<boolean> = new Subject<boolean>();
  28. let bg = new BipartiteGraph([35, 50, 40], [45, 20, 30, 30], [[8, 6, 10, 9], [9, 12, 13, 7], [14, 9, 16, 5]]);
  29.  
  30. const n = 3, m = 4;
  31.  
  32. let i = 1, j = 1;
  33. while (i <= n && j <= m) {
  34. bg.setAmount(i, j, Math.min(bg.getCapacity(i), bg.getDemand(j)));
  35. bg.setCapacity(i, bg.getCapacity(i) - bg.getAmount(i, j)); bg.setDemand(j, bg.getDemand(j) - bg.getAmount(i, j));
  36. if (bg.getCapacity(i) === 0) {
  37. i = i + 1;
  38. } else {
  39. j = j + 1;
  40. }
  41. }
  42.  
  43. bg.draw();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement