FusionAtlasPaths={"~/projects/fusionatlas/code/package/","~/Documents/fusionatlas/code/package/"};
$Path=$Path~Join~FusionAtlasPaths;
<<FusionAtlas`

SetDirectory[ToFileName[NotebookDirectory[],"../../text"]]

Run["grep -o gbg[0-9vpx]* ../index5-part2.tex > bigraphs0.list"];
Run["for source in `ls *.tex`;do grep -o gbg[0-9vpx]* $source;done >> bigraphs0.list"];
Run["grep -o bwd[0-9vpx]*duals[0-9vx]* ../index5-part2.tex >> bigraphs0.list"];
Run["for source in `ls *.tex`;do grep -o bwd[0-9vpx]*duals[0-9vx]* $source;done >> bigraphs0.list"];
Run["sort < bigraphs0.list | uniq > bigraphs.list"];
Run["rm bigraphs0.list"];

graphs=GraphFromString/@ReadList["bigraphs.list",String];

DisplayBigraph/@graphs

g=RandomChoice[graphs]

DisplayBigraph[g_,"PNG"]:=Rasterize[Show[Graphics[{AbsolutePointSize[8],AbsoluteThickness[2]}~Join~DisplayBigraph[g][[1]]],AspectRatio->1/GraphDepth[g]],ImageSize->{GraphDepth[g]50,50},Background->None]

DisplayBigraph[g,"PNG"]

bwd=BigraphWithDuals[GradedBigraph[{{1}},{{1}},{{1}},{{1},{1}},{{1,0},{0,1}}],DualData[{1},{1},{1,2}]];

DisplayBigraph[HaagerupWithDuals,"PNG"]

SetDirectory["../diagrams/bigraphs/"];

Export[GraphToString[#]<>".png",DisplayBigraph[#,"PNG"]]&/@graphs;

Run["whoami > pngcrush.out; date >> pngcrush.out; /opt/local/bin/pngcrush -rem allb -d crushed *.png > pngcrush.out; mv crushed/*.png .;rmdir crushed"]