Graph database Analysis of the Steam Network
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
923 B

  1. ;(function(undefined) {
  2. 'use strict';
  3. if (typeof sigma === 'undefined')
  4. throw 'sigma is not declared';
  5. // Initialize packages:
  6. sigma.utils.pkg('sigma.middlewares');
  7. /**
  8. * This middleware will just copy the graphic properties.
  9. *
  10. * @param {?string} readPrefix The read prefix.
  11. * @param {?string} writePrefix The write prefix.
  12. */
  13. sigma.middlewares.copy = function(readPrefix, writePrefix) {
  14. var i,
  15. l,
  16. a;
  17. if (writePrefix + '' === readPrefix + '')
  18. return;
  19. a = this.graph.nodes();
  20. for (i = 0, l = a.length; i < l; i++) {
  21. a[i][writePrefix + 'x'] = a[i][readPrefix + 'x'];
  22. a[i][writePrefix + 'y'] = a[i][readPrefix + 'y'];
  23. a[i][writePrefix + 'size'] = a[i][readPrefix + 'size'];
  24. }
  25. a = this.graph.edges();
  26. for (i = 0, l = a.length; i < l; i++)
  27. a[i][writePrefix + 'size'] = a[i][readPrefix + 'size'];
  28. };
  29. }).call(this);