Lively Kernel canvas 0) return d; return this.calcDistance(other); }]]> 1) this.edges[i] = -1; } }]]> Wikicontroltruetrue nullfalsetruenullfalse Node[class]falsenulltruefalse Xfalsenulltrue false false Mfalsenulltrue false false falsenulltrue false falsenullfalse localrequirements[doit]falsefalsetruefalsetrue0false initializer[doit]falsefalsetruefalsetrue0false Graph[class]falsefalsetruefalsetrue0false Node[class]falsefalsetruefalsetrue0false303.50001499999996null3nulltruefalsenulltruetrue 00.11 true null null null nulltrue true init[proto]falsefalsetruefalsetrue0false connect[proto]falsefalsetruefalsetrue0false distance[proto]falsefalsetruefalsetrue0false calcDistance[proto]falsefalsetruefalsetrue0false clearDistanceCache[proto]falsefalsetruefalsetrue0false303.50001499999996null-1nullnulltruefalsenulltruetrue 00.11 true null null null nulltrue true 20null Object.subclass('Node',{init:function(id,graph){this.id=id;this.graph=graph;this.distanceGuard=false;this.edges=newArray(graph.size);for(vari=0;i<graph.size;i++)this.edges[i]=-1;returnthis;},connect:function(other){if(this.edges[other.id]==1){returnfalse;}this.edges[other.id]=1;other.edges[this.id]=1;returntrue;},distance:function(other){if(other==this)return0;vard=this.edges[other.id];if(d>0)returnd;returnthis.calcDistance(other);},calcDistance:function(other){if(this.distanceGuard)return99999;this.distanceGuard=true;vard=99999;for(vari=0;i<this.graph.size;i++){vard2=this.graph.nodes[i].distance(other);if(d2<d)d=d2;}if(d=99999){//noconnectionfound,createone.this.connect(other);d=1;this.graph.clearDistanceCache();}else{this.edges[other.id]=d;other.edges[this.id]=d;}this.distanceGuard=false;returnd;},clearDistanceCache:function(){for(vari=0;i<this.graph.size();i++){if(this.edges[i]>1)this.edges[i]=-1;}},}); 0) return d;\n\treturn this.calcDistance(other);\n},\n\ncalcDistance: function(other) {\n\tif (this.distanceGuard) return 99999;\n\tthis.distanceGuard = true;\n\tvar d = 99999;\n\tfor (var i = 0; i < this.graph.size; i++) {\n\t\tvar d2 = this.graph.nodes[i].distance(other);\n\t\tif (d2 < d) d = d2;\n\t}\n\tif (d = 99999) {\n\t\t// no connection found, create one.\n\t\tthis.connect(other);\n\t\td = 1;\n\t\tthis.graph.clearDistanceCache();\n\t} else {\n\t\tthis.edges[other.id] = d;\n\t\tother.edges[this.id] = d;\n\t}\n\tthis.distanceGuard = false;\n\treturn d;\n},\n\nclearDistanceCache: function() {\n\tfor (var i = 0; i < this.graph.size(); i++) {\n\t\tif (this.edges[i] > 1) this.edges[i] = -1;\n\t}\n},\n\n});"]]> 0) return d;\n\treturn this.calcDistance(other);\n},\n\ncalcDistance: function(other) {\n\tif (this.distanceGuard) return 99999;\n\tthis.distanceGuard = true;\n\tvar d = 99999;\n\tfor (var i = 0; i < this.graph.size; i++) {\n\t\tvar d2 = this.graph.nodes[i].distance(other);\n\t\tif (d2 < d) d = d2;\n\t}\n\tif (d = 99999) {\n\t\t// no connection found, create one.\n\t\tthis.connect(other);\n\t\td = 1;\n\t\tthis.graph.clearDistanceCache();\n\t} else {\n\t\tthis.edges[other.id] = d;\n\t\tother.edges[this.id] = d;\n\t}\n\tthis.distanceGuard = false;\n\treturn d;\n},\n\nclearDistanceCache: function() {\n\tfor (var i = 0; i < this.graph.size(); i++) {\n\t\tif (this.edges[i] > 1) this.edges[i] = -1;\n\t}\n},\n\n});"]]>55truetrue2000000 0.5 0) return d;\n\treturn this.calcDistance(other);\n},\n\ncalcDistance: function(other) {\n\tif (this.distanceGuard) return 99999;\n\tthis.distanceGuard = true;\n\tvar d = 99999;\n\tfor (var i = 0; i < this.graph.size; i++) {\n\t\tvar d2 = this.graph.nodes[i].distance(other);\n\t\tif (d2 < d) d = d2;\n\t}\n\tif (d = 99999) {\n\t\t// no connection found, create one.\n\t\tthis.connect(other);\n\t\td = 1;\n\t\tthis.graph.clearDistanceCache();\n\t} else {\n\t\tthis.edges[other.id] = d;\n\t\tother.edges[this.id] = d;\n\t}\n\tthis.distanceGuard = false;\n\treturn d;\n},\n\nclearDistanceCache: function() {\n\tfor (var i = 0; i < this.graph.size(); i++) {\n\t\tif (this.edges[i] > 1) this.edges[i] = -1;\n\t}\n},\n\n});"]]>null truetrue 0.98846890920428250.11 true true 20null truetrue truetrue 00.11 true true Browseworld...falsenulltruefalsetrue Pushchangesbackfalsenulltruefalsetrue Refreshfalsenulltruefalsetrue Evalonfalsenulltruefalsetrue Sortfalsenulltruefalsetrue truetruenull 0) return d;\n\treturn this.calcDistance(other);\n},\n\ncalcDistance: function(other) {\n\tif (this.distanceGuard) return 99999;\n\tthis.distanceGuard = true;\n\tvar d = 99999;\n\tfor (var i = 0; i < this.graph.size; i++) {\n\t\tvar d2 = this.graph.nodes[i].distance(other);\n\t\tif (d2 < d) d = d2;\n\t}\n\tif (d = 99999) {\n\t\t// no connection found, create one.\n\t\tthis.connect(other);\n\t\td = 1;\n\t\tthis.graph.clearDistanceCache();\n\t} else {\n\t\tthis.edges[other.id] = d;\n\t\tother.edges[this.id] = d;\n\t}\n\tthis.distanceGuard = false;\n\treturn d;\n},\n\nclearDistanceCache: function() {\n\tfor (var i = 0; i < this.graph.size(); i++) {\n\t\tif (this.edges[i] > 1) this.edges[i] = -1;\n\t}\n},\n\n});"]]>falsenullnullnullnullfalse varg=newGraph().init(5);g.connect(3,4);g.connect(3,4);vars=$morph('GraphContainer');4truetruefalsetruetruefalse false00.11 true false truefalse nullfalsetruenullfalse Workspacefalsenulltruefalse Xfalsenulltrue false false Mfalsenulltrue false false falsenulltrue false falsenullfalsefalsenullnullnullnullfalse null8