import * as util from '../common/util';
import * as io from '../io/cgd';
import * as pgr from '../pgraphs/periodic';
import * as sym from '../pgraphs/symmetries';
import * as inv from '../pgraphs/invariant';


const fs = require('fs');

Array.prototype.toString = function() {
  return `${this.map(x => x.toString()).join(' ')}`;
};


const graphs = [];

process.argv.slice(2).forEach(file => {
  const text = fs.readFileSync(file, { encoding: 'utf8' });

  for (const { graph, name } of io.structures(text))
    graphs.push({ graph, name });
});

graphs.sort(({graph: g1, name: n1}, {graph: g2, name: n2}) =>
            (pgr.vertices(g1).size - pgr.vertices(g2).size ||
             g1.edges.size - g2.edges.size));

for (const { graph, name } of graphs) {
  console.log('PERIODIC_GRAPH');
  console.log(`  NAME ${name}`);
  for (const e of graph.edges)
    console.log(`    ${e.head} ${e.tail} ${e.shift}`);
  console.log('END');
  console.log();
}

@@ -1,44 +1,4 @@
-import * as util from '../common/util';%0A
 impo
@@ -74,100 +74,8 @@
 c';%0A
-import * as sym from '../pgraphs/symmetries';%0Aimport * as inv from '../pgraphs/invariant';%0A%0A
 %0Acon
@@ -686,16 +686,42 @@
 ame%7D%60);%0A
+  console.log('  EDGES');%0A
   for (c

fix output format; remove unused imports