UNPKG

dc.graph

Version:

Graph visualizations integrated with crossfilter and dc.js

2 lines 42.1 kB
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a){var b="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};b.graphlibDot=a("./index")},{"./index":2}],2:[function(a,b){var c=a("./lib/parse"),d=a("./lib/write"),e=a("./lib/version");b.exports={DotGraph:a("./lib/DotGraph"),DotDigraph:a("./lib/DotDigraph"),parse:c,decode:c,parseMany:c.parseMany,write:d,encode:d,version:e,type:"dot",buffer:!1}},{"./lib/DotDigraph":3,"./lib/DotGraph":4,"./lib/parse":8,"./lib/version":9,"./lib/write":10}],3:[function(a,b){var c=a("graphlib").CDigraph,d=a("./dotify"),e=d(c);b.exports=e,e.fromDigraph=function(a){var b=new e,c=a.graph();return void 0!==c&&b.graph(c),a.eachNode(function(a,c){void 0===c?b.addNode(a):b.addNode(a,c)}),a.eachEdge(function(a,c,d,e){void 0===e?b.addEdge(null,c,d):b.addEdge(null,c,d,e)}),b}},{"./dotify":7,graphlib:11}],4:[function(a,b){var c=a("graphlib").CGraph,d=a("./dotify"),e=d(c);b.exports=e,e.fromGraph=function(a){var b=new e,c=a.graph();return void 0!==c&&b.graph(c),a.eachNode(function(a,c){void 0===c?b.addNode(a):b.addNode(a,c)}),a.eachEdge(function(a,c,d,e){void 0===e?b.addEdge(null,c,d):b.addEdge(null,c,d,e)}),b}},{"./dotify":7,graphlib:11}],5:[function(a,b){function c(){this._indent="",this._content="",this._shouldIndent=!0}b.exports=c;var d=" ";c.prototype.indent=function(){this._indent+=d},c.prototype.unindent=function(){this._indent=this._indent.slice(d.length)},c.prototype.writeLine=function(a){this.write((a||"")+"\n"),this._shouldIndent=!0},c.prototype.write=function(a){this._shouldIndent&&(this._shouldIndent=!1,this._content+=this._indent),this._content+=a},c.prototype.toString=function(){return this._content}},{}],6:[function(a,b){b.exports=function(){function a(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var b={parse:function(b,c){function d(a){O>M||(M>O&&(O=M,P=[]),P.push(a))}function e(){var a,b;if(b=f(),null!==b)for(a=[];null!==b;)a.push(b),b=f();else a=null;return a}function f(){var a,c,e,f,h,i,j,k,l,m,n,o,p,q,r,s;for(q=M,r=M,a=[],c=G();null!==c;)a.push(c),c=G();if(null!==a)if(s=M,c=C(),null!==c?(e=G(),null!==e?c=[c,e]:(c=null,M=s)):(c=null,M=s),c=null!==c?c:"",null!==c)if(e=D(),null!==e){for(f=[],h=G();null!==h;)f.push(h),h=G();if(null!==f)if(h=w(),h=null!==h?h:"",null!==h){for(i=[],j=G();null!==j;)i.push(j),j=G();if(null!==i)if(123===b.charCodeAt(M)?(j="{",M++):(j=null,0===N&&d('"{"')),null!==j){for(k=[],l=G();null!==l;)k.push(l),l=G();if(null!==k)if(l=g(),l=null!==l?l:"",null!==l){for(m=[],n=G();null!==n;)m.push(n),n=G();if(null!==m)if(125===b.charCodeAt(M)?(n="}",M++):(n=null,0===N&&d('"}"')),null!==n){for(o=[],p=G();null!==p;)o.push(p),p=G();null!==o?a=[a,c,e,f,h,i,j,k,l,m,n,o]:(a=null,M=r)}else a=null,M=r;else a=null,M=r}else a=null,M=r;else a=null,M=r}else a=null,M=r;else a=null,M=r}else a=null,M=r;else a=null,M=r}else a=null,M=r;else a=null,M=r;else a=null,M=r;return null!==a&&(a=function(a,b,c,d){return{type:b,id:c,stmts:d}}(q,a[2],a[4],a[8])),null===a&&(M=q),a}function g(){var a,c,e,f,g,i,j,k,l,m,n;if(l=M,m=M,a=h(),null!==a){for(c=[],e=G();null!==e;)c.push(e),e=G();if(null!==c)if(59===b.charCodeAt(M)?(e=";",M++):(e=null,0===N&&d('";"')),e=null!==e?e:"",null!==e){for(f=[],n=M,g=[],i=G();null!==i;)g.push(i),i=G();if(null!==g)if(i=h(),null!==i){for(j=[],k=G();null!==k;)j.push(k),k=G();null!==j?(59===b.charCodeAt(M)?(k=";",M++):(k=null,0===N&&d('";"')),k=null!==k?k:"",null!==k?g=[g,i,j,k]:(g=null,M=n)):(g=null,M=n)}else g=null,M=n;else g=null,M=n;for(;null!==g;){for(f.push(g),n=M,g=[],i=G();null!==i;)g.push(i),i=G();if(null!==g)if(i=h(),null!==i){for(j=[],k=G();null!==k;)j.push(k),k=G();null!==j?(59===b.charCodeAt(M)?(k=";",M++):(k=null,0===N&&d('";"')),k=null!==k?k:"",null!==k?g=[g,i,j,k]:(g=null,M=n)):(g=null,M=n)}else g=null,M=n;else g=null,M=n}null!==f?a=[a,c,e,f]:(a=null,M=m)}else a=null,M=m;else a=null,M=m}else a=null,M=m;return null!==a&&(a=function(a,b,c){for(var d=[b],e=0;e<c.length;++e)d.push(c[e][1]);return d}(l,a[0],a[3])),null===a&&(M=l),a}function h(){var a;return a=i(),null===a&&(a=l(),null===a&&(a=m(),null===a&&(a=j(),null===a&&(a=k())))),a}function i(){var a,b,c,d,e;if(d=M,e=M,a=z(),null===a&&(a=x(),null===a&&(a=y())),null!==a){for(b=[],c=G();null!==c;)b.push(c),c=G();null!==b?(c=n(),null!==c?a=[a,b,c]:(a=null,M=e)):(a=null,M=e)}else a=null,M=e;return null!==a&&(a=function(a,b,c){return{type:"attr",attrType:b,attrs:c||{}}}(d,a[0],a[2])),null===a&&(M=d),a}function j(){var a,c,e,f,g,h,i;if(h=M,i=M,a=w(),null!==a){for(c=[],e=G();null!==e;)c.push(e),e=G();if(null!==c)if(61===b.charCodeAt(M)?(e="=",M++):(e=null,0===N&&d('"="')),null!==e){for(f=[],g=G();null!==g;)f.push(g),g=G();null!==f?(g=w(),null!==g?a=[a,c,e,f,g]:(a=null,M=i)):(a=null,M=i)}else a=null,M=i;else a=null,M=i}else a=null,M=i;return null!==a&&(a=function(a,b,c){var d={};return d[b]=c,{type:"inlineAttr",attrs:d}}(h,a[0],a[4])),null===a&&(M=h),a}function k(){var a,b,c,d,e;if(d=M,e=M,a=t(),null!==a){for(b=[],c=G();null!==c;)b.push(c),c=G();null!==b?(c=n(),c=null!==c?c:"",null!==c?a=[a,b,c]:(a=null,M=e)):(a=null,M=e)}else a=null,M=e;return null!==a&&(a=function(a,b,c){return{type:"node",id:b,attrs:c||{}}}(d,a[0],a[2])),null===a&&(M=d),a}function l(){var a,b,c,d,e,f,g;if(f=M,g=M,a=s(),null!==a){for(b=[],c=G();null!==c;)b.push(c),c=G();if(null!==b)if(c=q(),null!==c){for(d=[],e=G();null!==e;)d.push(e),e=G();null!==d?(e=n(),e=null!==e?e:"",null!==e?a=[a,b,c,d,e]:(a=null,M=g)):(a=null,M=g)}else a=null,M=g;else a=null,M=g}else a=null,M=g;return null!==a&&(a=function(a,b,c,d){for(var e=[b],f=0;f<c.length;++f)e.push(c[f]);return{type:"edge",elems:e,attrs:d||{}}}(f,a[0],a[2],a[4])),null===a&&(M=f),a}function m(){var a,c,e,f,h,i,j,k,l,m;if(j=M,k=M,l=M,a=B(),null!==a){for(c=[],e=G();null!==e;)c.push(e),e=G();if(null!==c){if(m=M,e=w(),null!==e){for(f=[],h=G();null!==h;)f.push(h),h=G();null!==f?e=[e,f]:(e=null,M=m)}else e=null,M=m;e=null!==e?e:"",null!==e?a=[a,c,e]:(a=null,M=l)}else a=null,M=l}else a=null,M=l;if(a=null!==a?a:"",null!==a)if(123===b.charCodeAt(M)?(c="{",M++):(c=null,0===N&&d('"{"')),null!==c){for(e=[],f=G();null!==f;)e.push(f),f=G();if(null!==e)if(f=g(),f=null!==f?f:"",null!==f){for(h=[],i=G();null!==i;)h.push(i),i=G();null!==h?(125===b.charCodeAt(M)?(i="}",M++):(i=null,0===N&&d('"}"')),null!==i?a=[a,c,e,f,h,i]:(a=null,M=k)):(a=null,M=k)}else a=null,M=k;else a=null,M=k}else a=null,M=k;else a=null,M=k;return null!==a&&(a=function(a,b,c){return b=b[2]||[],{type:"subgraph",id:b[0],stmts:c}}(j,a[0],a[3])),null===a&&(M=j),a}function n(){var a,b,c,d,e,f,g;if(e=M,f=M,a=o(),null!==a){for(b=[],g=M,c=[],d=G();null!==d;)c.push(d),d=G();for(null!==c?(d=o(),null!==d?c=[c,d]:(c=null,M=g)):(c=null,M=g);null!==c;){for(b.push(c),g=M,c=[],d=G();null!==d;)c.push(d),d=G();null!==c?(d=o(),null!==d?c=[c,d]:(c=null,M=g)):(c=null,M=g)}null!==b?a=[a,b]:(a=null,M=f)}else a=null,M=f;return null!==a&&(a=function(a,b,c){for(var d=b,e=0;e<c.length;++e)d=J(d,c[e][1]);return d}(e,a[0],a[1])),null===a&&(M=e),a}function o(){var a,c,e,f,g,h,i;if(h=M,i=M,91===b.charCodeAt(M)?(a="[",M++):(a=null,0===N&&d('"["')),null!==a){for(c=[],e=G();null!==e;)c.push(e),e=G();if(null!==c)if(e=p(),e=null!==e?e:"",null!==e){for(f=[],g=G();null!==g;)f.push(g),g=G();null!==f?(93===b.charCodeAt(M)?(g="]",M++):(g=null,0===N&&d('"]"')),null!==g?a=[a,c,e,f,g]:(a=null,M=i)):(a=null,M=i)}else a=null,M=i;else a=null,M=i}else a=null,M=i;return null!==a&&(a=function(a,b){return b}(h,a[2])),null===a&&(M=h),a}function p(){var a,c,e,f,g,h,i,j,k;if(i=M,j=M,a=r(),null!==a){for(c=[],k=M,e=[],f=G();null!==f;)e.push(f),f=G();if(null!==e)if(44===b.charCodeAt(M)?(f=",",M++):(f=null,0===N&&d('","')),f=null!==f?f:"",null!==f){for(g=[],h=G();null!==h;)g.push(h),h=G();null!==g?(h=r(),null!==h?e=[e,f,g,h]:(e=null,M=k)):(e=null,M=k)}else e=null,M=k;else e=null,M=k;for(;null!==e;){for(c.push(e),k=M,e=[],f=G();null!==f;)e.push(f),f=G();if(null!==e)if(44===b.charCodeAt(M)?(f=",",M++):(f=null,0===N&&d('","')),f=null!==f?f:"",null!==f){for(g=[],h=G();null!==h;)g.push(h),h=G();null!==g?(h=r(),null!==h?e=[e,f,g,h]:(e=null,M=k)):(e=null,M=k)}else e=null,M=k;else e=null,M=k}null!==c?a=[a,c]:(a=null,M=j)}else a=null,M=j;return null!==a&&(a=function(a,b,c){for(var d=b,e=0;e<c.length;++e)d=J(d,c[e][3]);return d}(i,a[0],a[1])),null===a&&(M=i),a}function q(){var a,c,e,f,g,h,i,j;if(h=M,i=M,j=M,"--"===b.substr(M,2)?(a="--",M+=2):(a=null,0===N&&d('"--"')),null!==a?(c=function(){return L}(M)?null:"",null!==c?a=[a,c]:(a=null,M=j)):(a=null,M=j),null===a&&(j=M,"->"===b.substr(M,2)?(a="->",M+=2):(a=null,0===N&&d('"->"')),null!==a?(c=function(){return L}(M)?"":null,null!==c?a=[a,c]:(a=null,M=j)):(a=null,M=j)),null!==a){for(c=[],e=G();null!==e;)c.push(e),e=G();if(null!==c)if(e=s(),null!==e){for(f=[],g=G();null!==g;)f.push(g),g=G();null!==f?(g=q(),g=null!==g?g:"",null!==g?a=[a,c,e,f,g]:(a=null,M=i)):(a=null,M=i)}else a=null,M=i;else a=null,M=i}else a=null,M=i;return null!==a&&(a=function(a,b,c){for(var d=[b],e=0;e<c.length;++e)d.push(c[e]);return d}(h,a[2],a[4])),null===a&&(M=h),a}function r(){var a,c,e,f,g,h,i,j;if(h=M,i=M,a=w(),null!==a){for(j=M,c=[],e=G();null!==e;)c.push(e),e=G();if(null!==c)if(61===b.charCodeAt(M)?(e="=",M++):(e=null,0===N&&d('"="')),null!==e){for(f=[],g=G();null!==g;)f.push(g),g=G();null!==f?(g=w(),null!==g?c=[c,e,f,g]:(c=null,M=j)):(c=null,M=j)}else c=null,M=j;else c=null,M=j;c=null!==c?c:"",null!==c?a=[a,c]:(a=null,M=i)}else a=null,M=i;return null!==a&&(a=function(a,b,c){var d={};return d[b]=c[3],d}(h,a[0],a[1])),null===a&&(M=h),a}function s(){var a,b;return a=m(),null===a&&(b=M,a=t(),null!==a&&(a=function(a,b){return{type:"node",id:b,attrs:{}}}(b,a)),null===a&&(M=b)),a}function t(){var a,b,c,d,e;if(d=M,e=M,a=w(),null!==a){for(b=[],c=G();null!==c;)b.push(c),c=G();null!==b?(c=u(),c=null!==c?c:"",null!==c?a=[a,b,c]:(a=null,M=e)):(a=null,M=e)}else a=null,M=e;return null!==a&&(a=function(a,b){return b}(d,a[0])),null===a&&(M=d),a}function u(){var a,c,e,f,g,h,i,j,k;if(j=M,58===b.charCodeAt(M)?(a=":",M++):(a=null,0===N&&d('":"')),null!==a){for(c=[],e=G();null!==e;)c.push(e),e=G();if(null!==c)if(e=w(),null!==e){for(f=[],g=G();null!==g;)f.push(g),g=G();if(null!==f){if(k=M,58===b.charCodeAt(M)?(g=":",M++):(g=null,0===N&&d('":"')),null!==g){for(h=[],i=G();null!==i;)h.push(i),i=G();null!==h?(i=v(),null!==i?g=[g,h,i]:(g=null,M=k)):(g=null,M=k)}else g=null,M=k;g=null!==g?g:"",null!==g?a=[a,c,e,f,g]:(a=null,M=j)}else a=null,M=j}else a=null,M=j;else a=null,M=j}else a=null,M=j;return a}function v(){var a;return 110===b.charCodeAt(M)?(a="n",M++):(a=null,0===N&&d('"n"')),null===a&&("ne"===b.substr(M,2)?(a="ne",M+=2):(a=null,0===N&&d('"ne"')),null===a&&(101===b.charCodeAt(M)?(a="e",M++):(a=null,0===N&&d('"e"')),null===a&&("se"===b.substr(M,2)?(a="se",M+=2):(a=null,0===N&&d('"se"')),null===a&&(115===b.charCodeAt(M)?(a="s",M++):(a=null,0===N&&d('"s"')),null===a&&("sw"===b.substr(M,2)?(a="sw",M+=2):(a=null,0===N&&d('"sw"')),null===a&&(119===b.charCodeAt(M)?(a="w",M++):(a=null,0===N&&d('"w"')),null===a&&("nw"===b.substr(M,2)?(a="nw",M+=2):(a=null,0===N&&d('"nw"')),null===a&&(99===b.charCodeAt(M)?(a="c",M++):(a=null,0===N&&d('"c"')),null===a&&(95===b.charCodeAt(M)?(a="_",M++):(a=null,0===N&&d('"_"'))))))))))),a}function w(){var a,c,e,f,g,h,i,j,k;if(N++,h=M,i=M,/^[a-zA-Z\u0200-\u0377_]/.test(b.charAt(M))?(a=b.charAt(M),M++):(a=null,0===N&&d("[a-zA-Z\\u0200-\\u0377_]")),null!==a){for(c=[],/^[a-zA-Z\u0200-\u0377_0-9]/.test(b.charAt(M))?(e=b.charAt(M),M++):(e=null,0===N&&d("[a-zA-Z\\u0200-\\u0377_0-9]"));null!==e;)c.push(e),/^[a-zA-Z\u0200-\u0377_0-9]/.test(b.charAt(M))?(e=b.charAt(M),M++):(e=null,0===N&&d("[a-zA-Z\\u0200-\\u0377_0-9]"));null!==c?a=[a,c]:(a=null,M=i)}else a=null,M=i;if(null!==a&&(a=function(a,b,c){return b+c.join("")}(h,a[0],a[1])),null===a&&(M=h),null===a){if(h=M,i=M,45===b.charCodeAt(M)?(a="-",M++):(a=null,0===N&&d('"-"')),a=null!==a?a:"",null!==a)if(46===b.charCodeAt(M)?(c=".",M++):(c=null,0===N&&d('"."')),null!==c){if(/^[0-9]/.test(b.charAt(M))?(f=b.charAt(M),M++):(f=null,0===N&&d("[0-9]")),null!==f)for(e=[];null!==f;)e.push(f),/^[0-9]/.test(b.charAt(M))?(f=b.charAt(M),M++):(f=null,0===N&&d("[0-9]"));else e=null;null!==e?a=[a,c,e]:(a=null,M=i)}else a=null,M=i;else a=null,M=i;if(null!==a&&(a=function(a,b,c,d){return b+c+d.join("")}(h,a[0],a[1],a[2])),null===a&&(M=h),null===a){if(h=M,i=M,45===b.charCodeAt(M)?(a="-",M++):(a=null,0===N&&d('"-"')),a=null!==a?a:"",null!==a){if(/^[0-9]/.test(b.charAt(M))?(e=b.charAt(M),M++):(e=null,0===N&&d("[0-9]")),null!==e)for(c=[];null!==e;)c.push(e),/^[0-9]/.test(b.charAt(M))?(e=b.charAt(M),M++):(e=null,0===N&&d("[0-9]"));else c=null;if(null!==c){if(j=M,46===b.charCodeAt(M)?(e=".",M++):(e=null,0===N&&d('"."')),null!==e){for(f=[],/^[0-9]/.test(b.charAt(M))?(g=b.charAt(M),M++):(g=null,0===N&&d("[0-9]"));null!==g;)f.push(g),/^[0-9]/.test(b.charAt(M))?(g=b.charAt(M),M++):(g=null,0===N&&d("[0-9]"));null!==f?e=[e,f]:(e=null,M=j)}else e=null,M=j;e=null!==e?e:"",null!==e?a=[a,c,e]:(a=null,M=i)}else a=null,M=i}else a=null,M=i;if(null!==a&&(a=function(a,b,c,d){return b+c.join("")+(d[0]||"")+(d[1]||[]).join("")}(h,a[0],a[1],a[2])),null===a&&(M=h),null===a){if(h=M,i=M,34===b.charCodeAt(M)?(a='"',M++):(a=null,0===N&&d('"\\""')),null!==a){for(c=[],j=M,'\\"'===b.substr(M,2)?(e='\\"',M+=2):(e=null,0===N&&d('"\\\\\\""')),null!==e&&(e=function(){return'"'}(j)),null===e&&(M=j),null===e&&(j=M,k=M,92===b.charCodeAt(M)?(e="\\",M++):(e=null,0===N&&d('"\\\\"')),null!==e?(/^[^"]/.test(b.charAt(M))?(f=b.charAt(M),M++):(f=null,0===N&&d('[^"]')),null!==f?e=[e,f]:(e=null,M=k)):(e=null,M=k),null!==e&&(e=function(a,b){return"\\"+b}(j,e[1])),null===e&&(M=j),null===e&&(/^[^"]/.test(b.charAt(M))?(e=b.charAt(M),M++):(e=null,0===N&&d('[^"]'))));null!==e;)c.push(e),j=M,'\\"'===b.substr(M,2)?(e='\\"',M+=2):(e=null,0===N&&d('"\\\\\\""')),null!==e&&(e=function(){return'"'}(j)),null===e&&(M=j),null===e&&(j=M,k=M,92===b.charCodeAt(M)?(e="\\",M++):(e=null,0===N&&d('"\\\\"')),null!==e?(/^[^"]/.test(b.charAt(M))?(f=b.charAt(M),M++):(f=null,0===N&&d('[^"]')),null!==f?e=[e,f]:(e=null,M=k)):(e=null,M=k),null!==e&&(e=function(a,b){return"\\"+b}(j,e[1])),null===e&&(M=j),null===e&&(/^[^"]/.test(b.charAt(M))?(e=b.charAt(M),M++):(e=null,0===N&&d('[^"]'))));null!==c?(34===b.charCodeAt(M)?(e='"',M++):(e=null,0===N&&d('"\\""')),null!==e?a=[a,c,e]:(a=null,M=i)):(a=null,M=i)}else a=null,M=i;null!==a&&(a=function(a,b){return b.join("")}(h,a[1])),null===a&&(M=h)}}}return N--,0===N&&null===a&&d("identifier"),a}function x(){var a,c;return c=M,"node"===b.substr(M,4).toLowerCase()?(a=b.substr(M,4),M+=4):(a=null,0===N&&d('"node"')),null!==a&&(a=function(a,b){return b.toLowerCase()}(c,a)),null===a&&(M=c),a}function y(){var a,c;return c=M,"edge"===b.substr(M,4).toLowerCase()?(a=b.substr(M,4),M+=4):(a=null,0===N&&d('"edge"')),null!==a&&(a=function(a,b){return b.toLowerCase()}(c,a)),null===a&&(M=c),a}function z(){var a,c;return c=M,"graph"===b.substr(M,5).toLowerCase()?(a=b.substr(M,5),M+=5):(a=null,0===N&&d('"graph"')),null!==a&&(a=function(a,b){return b.toLowerCase()}(c,a)),null===a&&(M=c),a}function A(){var a,c;return c=M,"digraph"===b.substr(M,7).toLowerCase()?(a=b.substr(M,7),M+=7):(a=null,0===N&&d('"digraph"')),null!==a&&(a=function(a,b){return b.toLowerCase()}(c,a)),null===a&&(M=c),a}function B(){var a,c;return c=M,"subgraph"===b.substr(M,8).toLowerCase()?(a=b.substr(M,8),M+=8):(a=null,0===N&&d('"subgraph"')),null!==a&&(a=function(a,b){return b.toLowerCase()}(c,a)),null===a&&(M=c),a}function C(){var a,c;return c=M,"strict"===b.substr(M,6).toLowerCase()?(a=b.substr(M,6),M+=6):(a=null,0===N&&d('"strict"')),null!==a&&(a=function(a,b){return b.toLowerCase()}(c,a)),null===a&&(M=c),a}function D(){var a,b;return a=z(),null===a&&(b=M,a=A(),null!==a&&(a=function(a,b){return L="digraph"===b,b}(b,a)),null===a&&(M=b)),a}function E(){var a,c;if(N++,/^[ \t\r\n]/.test(b.charAt(M))?(c=b.charAt(M),M++):(c=null,0===N&&d("[ \\t\\r\\n]")),null!==c)for(a=[];null!==c;)a.push(c),/^[ \t\r\n]/.test(b.charAt(M))?(c=b.charAt(M),M++):(c=null,0===N&&d("[ \\t\\r\\n]"));else a=null;return N--,0===N&&null===a&&d("whitespace"),a}function F(){var a,c,e,f,g,h,i;if(N++,g=M,"//"===b.substr(M,2)?(a="//",M+=2):(a=null,0===N&&d('"//"')),null!==a){for(c=[],/^[^\n]/.test(b.charAt(M))?(e=b.charAt(M),M++):(e=null,0===N&&d("[^\\n]"));null!==e;)c.push(e),/^[^\n]/.test(b.charAt(M))?(e=b.charAt(M),M++):(e=null,0===N&&d("[^\\n]"));null!==c?a=[a,c]:(a=null,M=g)}else a=null,M=g;if(null===a)if(g=M,"/*"===b.substr(M,2)?(a="/*",M+=2):(a=null,0===N&&d('"/*"')),null!==a){for(c=[],h=M,i=M,N++,"*/"===b.substr(M,2)?(e="*/",M+=2):(e=null,0===N&&d('"*/"')),N--,null===e?e="":(e=null,M=i),null!==e?(b.length>M?(f=b.charAt(M),M++):(f=null,0===N&&d("any character")),null!==f?e=[e,f]:(e=null,M=h)):(e=null,M=h);null!==e;)c.push(e),h=M,i=M,N++,"*/"===b.substr(M,2)?(e="*/",M+=2):(e=null,0===N&&d('"*/"')),N--,null===e?e="":(e=null,M=i),null!==e?(b.length>M?(f=b.charAt(M),M++):(f=null,0===N&&d("any character")),null!==f?e=[e,f]:(e=null,M=h)):(e=null,M=h);null!==c?("*/"===b.substr(M,2)?(e="*/",M+=2):(e=null,0===N&&d('"*/"')),null!==e?a=[a,c,e]:(a=null,M=g)):(a=null,M=g)}else a=null,M=g;return N--,0===N&&null===a&&d("comment"),a}function G(){var a;return a=E(),null===a&&(a=F()),a}function H(a){a.sort();for(var b=null,c=[],d=0;d<a.length;d++)a[d]!==b&&(c.push(a[d]),b=a[d]);return c}function I(){for(var a=1,c=1,d=!1,e=0;e<Math.max(M,O);e++){var f=b.charAt(e);"\n"===f?(d||a++,c=1,d=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(a++,c=1,d=!0):(c++,d=!1)}return{line:a,column:c}}function J(a,b){var c={};for(var d in a)c[d]=a[d];for(var d in b)c[d]=b[d];return c}var K={start:e,graphStmt:f,stmtList:g,stmt:h,attrStmt:i,inlineAttrStmt:j,nodeStmt:k,edgeStmt:l,subgraphStmt:m,attrList:n,attrListBlock:o,aList:p,edgeRHS:q,idDef:r,nodeIdOrSubgraph:s,nodeId:t,port:u,compassPt:v,id:w,node:x,edge:y,graph:z,digraph:A,subgraph:B,strict:C,graphType:D,whitespace:E,comment:F,_:G};if(void 0!==c){if(void 0===K[c])throw new Error("Invalid rule name: "+a(c)+".")}else c="start";var L,M=0,N=0,O=0,P=[],Q=K[c]();if(null===Q||M!==b.length){var R=Math.max(M,O),S=R<b.length?b.charAt(R):null,T=I();throw new this.SyntaxError(H(P),S,R,T.line,T.column)}return Q},toSource:function(){return this._source}};return b.SyntaxError=function(b,c,d,e,f){function g(b,c){var d,e;switch(b.length){case 0:d="end of input";break;case 1:d=b[0];break;default:d=b.slice(0,b.length-1).join(", ")+" or "+b[b.length-1]}return e=c?a(c):"end of input","Expected "+d+" but "+e+" found."}this.name="SyntaxError",this.expected=b,this.found=c,this.message=g(b,c),this.offset=d,this.line=e,this.column=f},b.SyntaxError.prototype=Error.prototype,b}()},{}],7:[function(a,b){function c(a){function b(){a.call(this),this.graph({})}return b.prototype=new a,b.prototype.constructor=b,b.prototype.graph=function(b){return arguments.length<1?a.prototype.graph.call(this):(this._checkValueType(b),a.prototype.graph.call(this,b))},b.prototype.node=function(b,c){return arguments.length<2?a.prototype.node.call(this,b):(this._checkValueType(c),a.prototype.node.call(this,b,c))},b.prototype.addNode=function(b,c){return arguments.length<2&&(c={}),this._checkValueType(c),a.prototype.addNode.call(this,b,c)},b.prototype.edge=function(b,c){return arguments.length<2?a.prototype.edge.call(this,b):(this._checkValueType(c),a.prototype.edge.call(this,b,c))},b.prototype.addEdge=function(b,c,d,e){return arguments.length<4&&(e={}),this._checkValueType(e),a.prototype.addEdge.call(this,b,c,d,e)},b.prototype._checkValueType=function(a){if(null===a||"object"!=typeof a)throw new Error("Value must be non-null and of type 'object'")},b}b.exports=c},{}],8:[function(a,b){function c(a){var b=i.parse(a,"graphStmt");return e(b)}function d(a){var b=i.parse(a);return b.map(function(a){return e(a)})}function e(a){function b(a,b,c){i.hasNode(a)||(i.addNode(a,j.get("node",{})),void 0===i.node(a).label&&(i.node(a).label=a),null!==c&&i.parent(a,c)),b&&f(b,i.node(a))}function c(a,b,c){var d={};f(j.get("edge",c),d);var e=c.id?c.id:null;i.addEdge(e,a,b,d)}function d(a){function b(a){e.push(a)}var c,d={},e=[];for(b(a);0!==e.length;)switch(c=e.pop(),c.type){case"node":d[c.id]=!0;break;case"edge":c.elems.forEach(b);break;case"subgraph":c.stmts.forEach(b)}return Object.keys(d)}function e(a,g){var h=a.attrs;switch(a.type){case"node":b(a.id,h,g);break;case"edge":var k,l;a.elems.forEach(function(a){switch(e(a,g),a.type){case"node":l=[a.id];break;case"subgraph":l=d(a);break;default:throw new Error("Unsupported type incident on edge: "+a.type)}k&&k.forEach(function(a){l.forEach(function(b){c(a,b,h)})}),k=l});break;case"subgraph":j.enterSubDigraph(),a.id=i.addNode(a.id),null!==g&&i.parent(a.id,g),a.stmts&&a.stmts.forEach(function(b){e(b,a.id)}),0===i.children(a.id).length&&i.delNode(a.id),j.exitSubDigraph();break;case"attr":j.set(a.attrType,h);break;case"inlineAttr":a.attrs&&f(h,null===g?i.graph():i.node(g));break;default:throw new Error("Unsupported statement type: "+a.type)}}var i="graph"===a.type?new h:new g,j={_default:{},get:function(a,b){if("undefined"!=typeof this._default[a]){var c={};return f(this._default[a],c),f(b,c),c}return b},set:function(a,b){this._default[a]=this.get(a,b)},enterSubDigraph:function(){function a(){}a.prototype=this._default;var b=new a;this._default=b},exitSubDigraph:function(){this._default=Object.getPrototypeOf(this._default)}};return a.stmts&&a.stmts.forEach(function(a){e(a,null)}),i}function f(a,b){Object.keys(a).forEach(function(c){b[c]=a[c]})}var g=a("./DotDigraph"),h=a("./DotGraph"),i=a("./dot-grammar");b.exports=c,b.exports.parseMany=d},{"./DotDigraph":3,"./DotGraph":4,"./dot-grammar":6}],9:[function(a,b){b.exports="0.4.9"},{}],10:[function(a,b){function c(a){var b=a.isDirected()?"->":"--",c=new h;c.writeLine((a.isDirected()?"digraph":"graph")+" {"),c.indent();var f=a.graph();return f&&Object.keys(f).map(function(a){c.writeLine(e(a)+"="+e(f[a])+";")}),d(a,null,c),a.edges().forEach(function(d){g(a,d,b,c)}),c.unindent(),c.writeLine("}"),c.toString()}function d(a,b,c){var g=a.children?a.children(b):null===b?a.nodes():[];g.forEach(function(b){if(a.children&&0!==a.children(b).length){c.writeLine("subgraph "+e(b)+" {"),c.indent();var g=a.node(b);Object.keys(g).map(function(a){c.writeLine(e(a)+"="+e(g[a])+";")}),d(a,b,c),c.unindent(),c.writeLine("}")}else f(a,b,c)})}function e(a){return"number"==typeof a||a.toString().match(i)?a:'"'+a.toString().replace(/"/g,'\\"')+'"'}function f(a,b,c){var d=a.node(b);if(c.write(e(b)),d){var f=Object.keys(d).map(function(a){return e(a)+"="+e(d[a])});f.length&&c.write(" ["+f.join(",")+"]")}c.writeLine()}function g(a,b,c,d){var f=a.edge(b),g=a.incidentNodes(b),h=g[0],i=g[1];if(d.write(e(h)+" "+c+" "+e(i)),f){var j=Object.keys(f).map(function(a){return e(a)+"="+e(f[a])});j.length&&d.write(" ["+j.join(",")+"]")}d.writeLine()}var h=a("./Writer");b.exports=c;var i=/^[a-zA-Z\200-\377_][a-zA-Z\200-\377_0-9]*$/},{"./Writer":5}],11:[function(a,b,c){c.Graph=a("./lib/Graph"),c.Digraph=a("./lib/Digraph"),c.CGraph=a("./lib/CGraph"),c.CDigraph=a("./lib/CDigraph"),a("./lib/graph-converters"),c.alg={isAcyclic:a("./lib/alg/isAcyclic"),components:a("./lib/alg/components"),dijkstra:a("./lib/alg/dijkstra"),dijkstraAll:a("./lib/alg/dijkstraAll"),findCycles:a("./lib/alg/findCycles"),floydWarshall:a("./lib/alg/floydWarshall"),postorder:a("./lib/alg/postorder"),preorder:a("./lib/alg/preorder"),prim:a("./lib/alg/prim"),tarjan:a("./lib/alg/tarjan"),topsort:a("./lib/alg/topsort")},c.converter={json:a("./lib/converter/json.js")};var d=a("./lib/filter");c.filter={all:d.all,nodesFromList:d.nodesFromList},c.version=a("./lib/version")},{"./lib/CDigraph":13,"./lib/CGraph":14,"./lib/Digraph":15,"./lib/Graph":16,"./lib/alg/components":17,"./lib/alg/dijkstra":18,"./lib/alg/dijkstraAll":19,"./lib/alg/findCycles":20,"./lib/alg/floydWarshall":21,"./lib/alg/isAcyclic":22,"./lib/alg/postorder":23,"./lib/alg/preorder":24,"./lib/alg/prim":25,"./lib/alg/tarjan":26,"./lib/alg/topsort":27,"./lib/converter/json.js":29,"./lib/filter":30,"./lib/graph-converters":31,"./lib/version":33}],12:[function(a,b){function c(){this._value=void 0,this._nodes={},this._edges={},this._nextId=0}function d(a,b,c){(a[b]||(a[b]=new f)).add(c)}function e(a,b,c){var d=a[b];d.remove(c),0===d.size()&&delete a[b]}var f=a("cp-data").Set;b.exports=c,c.prototype.order=function(){return Object.keys(this._nodes).length},c.prototype.size=function(){return Object.keys(this._edges).length},c.prototype.graph=function(a){return 0===arguments.length?this._value:(this._value=a,void 0)},c.prototype.hasNode=function(a){return a in this._nodes},c.prototype.node=function(a,b){var c=this._strictGetNode(a);return 1===arguments.length?c.value:(c.value=b,void 0)},c.prototype.nodes=function(){var a=[];return this.eachNode(function(b){a.push(b)}),a},c.prototype.eachNode=function(a){for(var b in this._nodes){var c=this._nodes[b];a(c.id,c.value)}},c.prototype.hasEdge=function(a){return a in this._edges},c.prototype.edge=function(a,b){var c=this._strictGetEdge(a);return 1===arguments.length?c.value:(c.value=b,void 0)},c.prototype.edges=function(){var a=[];return this.eachEdge(function(b){a.push(b)}),a},c.prototype.eachEdge=function(a){for(var b in this._edges){var c=this._edges[b];a(c.id,c.u,c.v,c.value)}},c.prototype.incidentNodes=function(a){var b=this._strictGetEdge(a);return[b.u,b.v]},c.prototype.addNode=function(a,b){if(void 0===a||null===a){do a="_"+ ++this._nextId;while(this.hasNode(a))}else if(this.hasNode(a))throw new Error("Graph already has node '"+a+"'");return this._nodes[a]={id:a,value:b},a},c.prototype.delNode=function(a){this._strictGetNode(a),this.incidentEdges(a).forEach(function(a){this.delEdge(a)},this),delete this._nodes[a]},c.prototype._addEdge=function(a,b,c,e,f,g){if(this._strictGetNode(b),this._strictGetNode(c),void 0===a||null===a){do a="_"+ ++this._nextId;while(this.hasEdge(a))}else if(this.hasEdge(a))throw new Error("Graph already has edge '"+a+"'");return this._edges[a]={id:a,u:b,v:c,value:e},d(f[c],b,a),d(g[b],c,a),a},c.prototype._delEdge=function(a,b,c){var d=this._strictGetEdge(a);e(b[d.v],d.u,a),e(c[d.u],d.v,a),delete this._edges[a]},c.prototype.copy=function(){var a=new this.constructor;return a.graph(this.graph()),this.eachNode(function(b,c){a.addNode(b,c)}),this.eachEdge(function(b,c,d,e){a.addEdge(b,c,d,e)}),a._nextId=this._nextId,a},c.prototype.filterNodes=function(a){var b=new this.constructor;return b.graph(this.graph()),this.eachNode(function(c,d){a(c)&&b.addNode(c,d)}),this.eachEdge(function(a,c,d,e){b.hasNode(c)&&b.hasNode(d)&&b.addEdge(a,c,d,e)}),b},c.prototype._strictGetNode=function(a){var b=this._nodes[a];if(void 0===b)throw new Error("Node '"+a+"' is not in graph");return b},c.prototype._strictGetEdge=function(a){var b=this._edges[a];if(void 0===b)throw new Error("Edge '"+a+"' is not in graph");return b}},{"cp-data":34}],13:[function(a,b){var c=a("./Digraph"),d=a("./compoundify"),e=d(c);b.exports=e,e.fromDigraph=function(a){var b=new e,c=a.graph();return void 0!==c&&b.graph(c),a.eachNode(function(a,c){void 0===c?b.addNode(a):b.addNode(a,c)}),a.eachEdge(function(a,c,d,e){void 0===e?b.addEdge(null,c,d):b.addEdge(null,c,d,e)}),b},e.prototype.toString=function(){return"CDigraph "+JSON.stringify(this,null,2)}},{"./Digraph":15,"./compoundify":28}],14:[function(a,b){var c=a("./Graph"),d=a("./compoundify"),e=d(c);b.exports=e,e.fromGraph=function(a){var b=new e,c=a.graph();return void 0!==c&&b.graph(c),a.eachNode(function(a,c){void 0===c?b.addNode(a):b.addNode(a,c)}),a.eachEdge(function(a,c,d,e){void 0===e?b.addEdge(null,c,d):b.addEdge(null,c,d,e)}),b},e.prototype.toString=function(){return"CGraph "+JSON.stringify(this,null,2)}},{"./Graph":16,"./compoundify":28}],15:[function(a,b){function c(){e.call(this),this._inEdges={},this._outEdges={}}var d=a("./util"),e=a("./BaseGraph"),f=a("cp-data").Set;b.exports=c,c.prototype=new e,c.prototype.constructor=c,c.prototype.isDirected=function(){return!0},c.prototype.successors=function(a){return this._strictGetNode(a),Object.keys(this._outEdges[a]).map(function(a){return this._nodes[a].id},this)},c.prototype.predecessors=function(a){return this._strictGetNode(a),Object.keys(this._inEdges[a]).map(function(a){return this._nodes[a].id},this)},c.prototype.neighbors=function(a){return f.union([this.successors(a),this.predecessors(a)]).keys()},c.prototype.sources=function(){var a=this;return this._filterNodes(function(b){return 0===a.inEdges(b).length})},c.prototype.sinks=function(){var a=this;return this._filterNodes(function(b){return 0===a.outEdges(b).length})},c.prototype.source=function(a){return this._strictGetEdge(a).u},c.prototype.target=function(a){return this._strictGetEdge(a).v},c.prototype.inEdges=function(a,b){this._strictGetNode(a);var c=f.union(d.values(this._inEdges[a])).keys();return arguments.length>1&&(this._strictGetNode(b),c=c.filter(function(a){return this.source(a)===b},this)),c},c.prototype.outEdges=function(a,b){this._strictGetNode(a);var c=f.union(d.values(this._outEdges[a])).keys();return arguments.length>1&&(this._strictGetNode(b),c=c.filter(function(a){return this.target(a)===b},this)),c},c.prototype.incidentEdges=function(a,b){return arguments.length>1?f.union([this.outEdges(a,b),this.outEdges(b,a)]).keys():f.union([this.inEdges(a),this.outEdges(a)]).keys()},c.prototype.toString=function(){return"Digraph "+JSON.stringify(this,null,2)},c.prototype.addNode=function(a,b){return a=e.prototype.addNode.call(this,a,b),this._inEdges[a]={},this._outEdges[a]={},a},c.prototype.delNode=function(a){e.prototype.delNode.call(this,a),delete this._inEdges[a],delete this._outEdges[a]},c.prototype.addEdge=function(a,b,c,d){return e.prototype._addEdge.call(this,a,b,c,d,this._inEdges,this._outEdges)},c.prototype.delEdge=function(a){e.prototype._delEdge.call(this,a,this._inEdges,this._outEdges)},c.prototype._filterNodes=function(a){var b=[];return this.eachNode(function(c){a(c)&&b.push(c)}),b}},{"./BaseGraph":12,"./util":32,"cp-data":34}],16:[function(a,b){function c(){e.call(this),this._incidentEdges={}}var d=a("./util"),e=a("./BaseGraph"),f=a("cp-data").Set;b.exports=c,c.prototype=new e,c.prototype.constructor=c,c.prototype.isDirected=function(){return!1},c.prototype.neighbors=function(a){return this._strictGetNode(a),Object.keys(this._incidentEdges[a]).map(function(a){return this._nodes[a].id},this)},c.prototype.incidentEdges=function(a,b){return this._strictGetNode(a),arguments.length>1?(this._strictGetNode(b),b in this._incidentEdges[a]?this._incidentEdges[a][b].keys():[]):f.union(d.values(this._incidentEdges[a])).keys()},c.prototype.toString=function(){return"Graph "+JSON.stringify(this,null,2)},c.prototype.addNode=function(a,b){return a=e.prototype.addNode.call(this,a,b),this._incidentEdges[a]={},a},c.prototype.delNode=function(a){e.prototype.delNode.call(this,a),delete this._incidentEdges[a]},c.prototype.addEdge=function(a,b,c,d){return e.prototype._addEdge.call(this,a,b,c,d,this._incidentEdges,this._incidentEdges)},c.prototype.delEdge=function(a){e.prototype._delEdge.call(this,a,this._incidentEdges,this._incidentEdges)}},{"./BaseGraph":12,"./util":32,"cp-data":34}],17:[function(a,b){function c(a){function b(c,d){e.has(c)||(e.add(c),d.push(c),a.neighbors(c).forEach(function(a){b(a,d)}))}var c=[],e=new d;return a.nodes().forEach(function(a){var d=[];b(a,d),d.length>0&&c.push(d)}),c}var d=a("cp-data").Set;b.exports=c},{"cp-data":34}],18:[function(a,b){function c(a,b,c,e){function f(b){var d=a.incidentNodes(b),e=d[0]!==i?d[0]:d[1],f=g[e],k=c(b),l=j.distance+k;if(0>k)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+b+" Weight: "+k); l<f.distance&&(f.distance=l,f.predecessor=i,h.decrease(e,l))}var g={},h=new d;c=c||function(){return 1},e=e||(a.isDirected()?function(b){return a.outEdges(b)}:function(b){return a.incidentEdges(b)}),a.nodes().forEach(function(a){var c=a===b?0:Number.POSITIVE_INFINITY;g[a]={distance:c},h.add(a,c)});for(var i,j;h.size()>0&&(i=h.removeMin(),j=g[i],j.distance!==Number.POSITIVE_INFINITY);)e(i).forEach(f);return g}var d=a("cp-data").PriorityQueue;b.exports=c},{"cp-data":34}],19:[function(a,b){function c(a,b,c){var e={};return a.nodes().forEach(function(f){e[f]=d(a,f,b,c)}),e}var d=a("./dijkstra");b.exports=c},{"./dijkstra":18}],20:[function(a,b){function c(a){return d(a).filter(function(a){return a.length>1})}var d=a("./tarjan");b.exports=c},{"./tarjan":26}],21:[function(a,b){function c(a,b,c){var d={},e=a.nodes();return b=b||function(){return 1},c=c||(a.isDirected()?function(b){return a.outEdges(b)}:function(b){return a.incidentEdges(b)}),e.forEach(function(f){d[f]={},d[f][f]={distance:0},e.forEach(function(a){f!==a&&(d[f][a]={distance:Number.POSITIVE_INFINITY})}),c(f).forEach(function(c){var e=a.incidentNodes(c),g=e[0]!==f?e[0]:e[1],h=b(c);h<d[f][g].distance&&(d[f][g]={distance:h,predecessor:f})})}),e.forEach(function(a){var b=d[a];e.forEach(function(c){var f=d[c];e.forEach(function(c){var d=f[a],e=b[c],g=f[c],h=d.distance+e.distance;h<g.distance&&(g.distance=h,g.predecessor=e.predecessor)})})}),d}b.exports=c},{}],22:[function(a,b){function c(a){try{d(a)}catch(b){if(b instanceof d.CycleException)return!1;throw b}return!0}var d=a("./topsort");b.exports=c},{"./topsort":27}],23:[function(a,b){function c(a,b,c){function e(b,d){if(f.has(b))throw new Error("The input graph is not a tree: "+a);f.add(b),a.neighbors(b).forEach(function(a){a!==d&&e(a,b)}),c(b)}var f=new d;if(a.isDirected())throw new Error("This function only works for undirected graphs");e(b)}var d=a("cp-data").Set;b.exports=c},{"cp-data":34}],24:[function(a,b){function c(a,b,c){function e(b,d){if(f.has(b))throw new Error("The input graph is not a tree: "+a);f.add(b),c(b),a.neighbors(b).forEach(function(a){a!==d&&e(a,b)})}var f=new d;if(a.isDirected())throw new Error("This function only works for undirected graphs");e(b)}var d=a("cp-data").Set;b.exports=c},{"cp-data":34}],25:[function(a,b){function c(a,b){function c(c){var d=a.incidentNodes(c),e=d[0]!==f?d[0]:d[1],g=i.priority(e);if(void 0!==g){var j=b(c);g>j&&(h[e]=f,i.decrease(e,j))}}var f,g=new d,h={},i=new e;if(0===a.order())return g;a.eachNode(function(a){i.add(a,Number.POSITIVE_INFINITY),g.addNode(a)}),i.decrease(a.nodes()[0],0);for(var j=!1;i.size()>0;){if(f=i.removeMin(),f in h)g.addEdge(null,f,h[f]);else{if(j)throw new Error("Input graph is not connected: "+a);j=!0}a.incidentEdges(f).forEach(c)}return g}var d=a("../Graph"),e=a("cp-data").PriorityQueue;b.exports=c},{"../Graph":16,"cp-data":34}],26:[function(a,b){function c(a){function b(g){var h=e[g]={onStack:!0,lowlink:c,index:c++};if(d.push(g),a.successors(g).forEach(function(a){a in e?e[a].onStack&&(h.lowlink=Math.min(h.lowlink,e[a].index)):(b(a),h.lowlink=Math.min(h.lowlink,e[a].lowlink))}),h.lowlink===h.index){var i,j=[];do i=d.pop(),e[i].onStack=!1,j.push(i);while(g!==i);f.push(j)}}if(!a.isDirected())throw new Error("tarjan can only be applied to a directed graph. Bad input: "+a);var c=0,d=[],e={},f=[];return a.nodes().forEach(function(a){a in e||b(a)}),f}b.exports=c},{}],27:[function(a,b){function c(a){function b(g){if(g in e)throw new d;g in c||(e[g]=!0,c[g]=!0,a.predecessors(g).forEach(function(a){b(a)}),delete e[g],f.push(g))}if(!a.isDirected())throw new Error("topsort can only be applied to a directed graph. Bad input: "+a);var c={},e={},f=[],g=a.sinks();if(0!==a.order()&&0===g.length)throw new d;return a.sinks().forEach(function(a){b(a)}),f}function d(){}b.exports=c,c.CycleException=d,d.prototype.toString=function(){return"Graph has at least one cycle"}},{}],28:[function(a,b){function c(a){function b(){a.call(this),this._parents={},this._children={"null":new d}}return b.prototype=new a,b.prototype.constructor=b,b.prototype.parent=function(a,b){if(this._strictGetNode(a),arguments.length<2)return this._parents[a];if(a===b)throw new Error("Cannot make "+a+" a parent of itself");null!==b&&this._strictGetNode(b),this._children[this._parents[a]].remove(a),this._parents[a]=b,this._children[b].add(a)},b.prototype.children=function(a){return null!==a&&this._strictGetNode(a),this._children[a].keys()},b.prototype.addNode=function(b,c){return b=a.prototype.addNode.call(this,b,c),this._parents[b]=null,this._children[b]=new d,this._children[null].add(b),b},b.prototype.delNode=function(b){var c=this.parent(b);return this._children[b].keys().forEach(function(a){this.parent(a,c)},this),this._children[c].remove(b),delete this._parents[b],delete this._children[b],a.prototype.delNode.call(this,b)},b.prototype.copy=function(){var b=a.prototype.copy.call(this);return this.nodes().forEach(function(a){b.parent(a,this.parent(a))},this),b},b.prototype.filterNodes=function(b){function c(a){var b=d.parent(a);return null===b||e.hasNode(b)?(f[a]=b,b):b in f?f[b]:c(b)}var d=this,e=a.prototype.filterNodes.call(this,b),f={};return e.eachNode(function(a){e.parent(a,c(a))}),e},b}var d=a("cp-data").Set;b.exports=c},{"cp-data":34}],29:[function(a,b,c){function d(a){return Object.prototype.toString.call(a).slice(8,-1)}var e=a("../Graph"),f=a("../Digraph"),g=a("../CGraph"),h=a("../CDigraph");c.decode=function(a,b,c){if(c=c||f,"Array"!==d(a))throw new Error("nodes is not an Array");if("Array"!==d(b))throw new Error("edges is not an Array");if("string"==typeof c)switch(c){case"graph":c=e;break;case"digraph":c=f;break;case"cgraph":c=g;break;case"cdigraph":c=h;break;default:throw new Error("Unrecognized graph type: "+c)}var i=new c;return a.forEach(function(a){i.addNode(a.id,a.value)}),i.parent&&a.forEach(function(a){a.children&&a.children.forEach(function(b){i.parent(b,a.id)})}),b.forEach(function(a){i.addEdge(a.id,a.u,a.v,a.value)}),i},c.encode=function(a){var b=[],c=[];a.eachNode(function(c,d){var e={id:c,value:d};if(a.children){var f=a.children(c);f.length&&(e.children=f)}b.push(e)}),a.eachEdge(function(a,b,d,e){c.push({id:a,u:b,v:d,value:e})});var d;if(a instanceof h)d="cdigraph";else if(a instanceof g)d="cgraph";else if(a instanceof f)d="digraph";else{if(!(a instanceof e))throw new Error("Couldn't determine type of graph: "+a);d="graph"}return{nodes:b,edges:c,type:d}}},{"../CDigraph":13,"../CGraph":14,"../Digraph":15,"../Graph":16}],30:[function(a,b,c){var d=a("cp-data").Set;c.all=function(){return function(){return!0}},c.nodesFromList=function(a){var b=new d(a);return function(a){return b.has(a)}}},{"cp-data":34}],31:[function(a){var b=a("./Graph"),c=a("./Digraph");b.prototype.toDigraph=b.prototype.asDirected=function(){var a=new c;return this.eachNode(function(b,c){a.addNode(b,c)}),this.eachEdge(function(b,c,d,e){a.addEdge(null,c,d,e),a.addEdge(null,d,c,e)}),a},c.prototype.toGraph=c.prototype.asUndirected=function(){var a=new b;return this.eachNode(function(b,c){a.addNode(b,c)}),this.eachEdge(function(b,c,d,e){a.addEdge(b,c,d,e)}),a}},{"./Digraph":15,"./Graph":16}],32:[function(a,b,c){c.values=function(a){var b,c=Object.keys(a),d=c.length,e=new Array(d);for(b=0;d>b;++b)e[b]=a[c[b]];return e}},{}],33:[function(a,b){b.exports="0.7.0"},{}],34:[function(a,b,c){c.Set=a("./lib/Set"),c.PriorityQueue=a("./lib/PriorityQueue"),c.version=a("./lib/version")},{"./lib/PriorityQueue":35,"./lib/Set":36,"./lib/version":37}],35:[function(a,b){function c(){this._arr=[],this._keyIndices={}}b.exports=c,c.prototype.size=function(){return this._arr.length},c.prototype.keys=function(){return this._arr.map(function(a){return a.key})},c.prototype.has=function(a){return a in this._keyIndices},c.prototype.priority=function(a){var b=this._keyIndices[a];return void 0!==b?this._arr[b].priority:void 0},c.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},c.prototype.add=function(a,b){if(!(a in this._keyIndices)){var c={key:a,priority:b},d=this._arr.length;return this._keyIndices[a]=d,this._arr.push(c),this._decrease(d),!0}return!1},c.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var a=this._arr.pop();return delete this._keyIndices[a.key],this._heapify(0),a.key},c.prototype.decrease=function(a,b){var c=this._keyIndices[a];if(b>this._arr[c].priority)throw new Error("New priority is greater than current priority. Key: "+a+" Old: "+this._arr[c].priority+" New: "+b);this._arr[c].priority=b,this._decrease(c)},c.prototype._heapify=function(a){var b=this._arr,c=2*a,d=c+1,e=a;c<b.length&&(e=b[c].priority<b[e].priority?c:e,d<b.length&&(e=b[d].priority<b[e].priority?d:e),e!==a&&(this._swap(a,e),this._heapify(e)))},c.prototype._decrease=function(a){for(var b,c=this._arr,d=c[a].priority;a>0&&(b=a>>1,!(c[b].priority<d));)this._swap(a,b),a=b},c.prototype._swap=function(a,b){var c=this._arr,d=this._keyIndices,e=c[a];c[a]=c[b],c[b]=e,d[c[a].key]=a,d[c[b].key]=b}},{}],36:[function(a,b){function c(a){if(this._size=0,this._keys={},a)for(var b=0,c=a.length;c>b;++b)this.add(a[b])}function d(a){var b,c=Object.keys(a),d=c.length,e=new Array(d);for(b=0;d>b;++b)e[b]=a[c[b]];return e}b.exports=c,c.intersect=function(a){if(0===a.length)return new c;for(var b=new c(a[0].keys?a[0].keys():a[0]),d=1,e=a.length;e>d;++d)for(var f=b.keys(),g=a[d].keys?a[d]:new c(a[d]),h=0,i=f.length;i>h;++h){var j=f[h];g.has(j)||b.remove(j)}return b},c.union=function(a){for(var b=a.reduce(function(a,b){return a+(b.size?b.size():b.length)},0),d=new Array(b),e=0,f=0,g=a.length;g>f;++f)for(var h=a[f],i=h.keys?h.keys():h,j=0,k=i.length;k>j;++j)d[e++]=i[j];return new c(d)},c.prototype.size=function(){return this._size},c.prototype.keys=function(){return d(this._keys)},c.prototype.has=function(a){return a in this._keys},c.prototype.add=function(a){return a in this._keys?!1:(this._keys[a]=a,++this._size,!0)},c.prototype.remove=function(a){return a in this._keys?(delete this._keys[a],--this._size,!0):!1}},{}],37:[function(a,b){b.exports="1.1.0"},{}]},{},[1]);