diff --git a/index.html b/index.html index a349f09..0fdb3d7 100644 --- a/index.html +++ b/index.html @@ -20,8 +20,19 @@ var N = Link:{} }; }, - Connect(inNodeMajor, inNodeMinor, inKey) + Connect(inNodeMajor, inNodeMinor, inKey, inUnique) { + if(inUnique) // bail if the nodes are already connected + { + let check = N.Step(inNodeMajor, inKey, true); + if(check) + { + if(check.indexOf(inNodeMinor) < 0) + { + return; + } + } + } N.Step(inNodeMajor, inKey, true, true).push(inNodeMinor); N.Step(inNodeMinor, inKey, false, true).push(inNodeMajor); }, @@ -31,7 +42,9 @@ var N = if(inNodeMinor === null) { - inNodeMajor.Link[inKey].Set.forEach( inLoopNode => + let check = N.Step(inNodeMajor, inKey); + if(!check){ return; } + check.forEach( inLoopNode => { if(inLoopNode.Link[inKey].Get.length == 1) { @@ -140,29 +153,6 @@ var N = }; - -