(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.createGraph=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i=0){fromNode.links.splice(idx,1)}}if(toNode){idx=indexOfElementInArray(link,toNode.links);if(idx>=0){toNode.links.splice(idx,1)}}recordLinkChange(link,"remove");exitModification();return true}function getLink(fromNodeId,toNodeId){var node=getNode(fromNodeId),i;if(!node||!node.links){return null}for(i=0;i0){graphPart.fire("changed",changes);changes.length=0}}function forEachNode(callback){if(typeof callback!=="function"){throw new Error("Function is expected to iterate over graph nodes. You passed "+callback)}var valuesIterator=nodes.values();var nextValue=valuesIterator.next();while(!nextValue.done){if(callback(nextValue.value)){return true}nextValue=valuesIterator.next()}}}function indexOfElementInArray(element,array){if(!array)return-1;if(array.indexOf){return array.indexOf(element)}var len=array.length,i;for(i=0;i1){fireArguments=Array.prototype.splice.call(arguments,1)}for(var i=0;i