@opentrace/components 0.1.0-pr.110.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/d3LayoutWorker-BMQ60AVN.js +864 -0
- package/dist/assets/d3LayoutWorker-BMQ60AVN.js.map +1 -0
- package/dist/assets/spacingWorker-hXLGHyRg.js +123 -0
- package/dist/assets/spacingWorker-hXLGHyRg.js.map +1 -0
- package/dist/components.css +1 -0
- package/dist/opentrace-components.cjs +7565 -0
- package/dist/opentrace-components.cjs.map +1 -0
- package/dist/opentrace-components.js +7565 -0
- package/dist/opentrace-components.js.map +1 -0
- package/dist/src/GraphCanvas.d.ts +60 -0
- package/dist/src/GraphCanvas.d.ts.map +1 -0
- package/dist/src/colors/communityColors.d.ts +31 -0
- package/dist/src/colors/communityColors.d.ts.map +1 -0
- package/dist/src/colors/linkColors.d.ts +2 -0
- package/dist/src/colors/linkColors.d.ts.map +1 -0
- package/dist/src/colors/nodeColors.d.ts +2 -0
- package/dist/src/colors/nodeColors.d.ts.map +1 -0
- package/dist/src/config/graphLayout.d.ts +51 -0
- package/dist/src/config/graphLayout.d.ts.map +1 -0
- package/dist/src/graph/LayoutPipeline.d.ts +26 -0
- package/dist/src/graph/LayoutPipeline.d.ts.map +1 -0
- package/dist/src/graph/drawNodeHover.d.ts +14 -0
- package/dist/src/graph/drawNodeHover.d.ts.map +1 -0
- package/dist/src/graph/spacingWorker.d.ts +43 -0
- package/dist/src/graph/spacingWorker.d.ts.map +1 -0
- package/dist/src/graph/types.d.ts +78 -0
- package/dist/src/graph/types.d.ts.map +1 -0
- package/dist/src/graph/useCommunities.d.ts +8 -0
- package/dist/src/graph/useCommunities.d.ts.map +1 -0
- package/dist/src/graph/useGraphFilters.d.ts +19 -0
- package/dist/src/graph/useGraphFilters.d.ts.map +1 -0
- package/dist/src/graph/useGraphInstance.d.ts +15 -0
- package/dist/src/graph/useGraphInstance.d.ts.map +1 -0
- package/dist/src/graph/useGraphVisuals.d.ts +9 -0
- package/dist/src/graph/useGraphVisuals.d.ts.map +1 -0
- package/dist/src/graph/useHighlights.d.ts +16 -0
- package/dist/src/graph/useHighlights.d.ts.map +1 -0
- package/dist/src/index.d.ts +27 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/sigma/zoomToNodes.d.ts +15 -0
- package/dist/src/sigma/zoomToNodes.d.ts.map +1 -0
- package/dist/src/types/graph.d.ts +33 -0
- package/dist/src/types/graph.d.ts.map +1 -0
- package/dist/src/utils.d.ts +16 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/workers/d3LayoutWorker.d.ts +22 -0
- package/dist/src/workers/d3LayoutWorker.d.ts.map +1 -0
- package/dist/useHighlights-BHlafcBH.js +6692 -0
- package/dist/useHighlights-BHlafcBH.js.map +1 -0
- package/dist/useHighlights-D6Jl6Woe.cjs +6691 -0
- package/dist/useHighlights-D6Jl6Woe.cjs.map +1 -0
- package/dist/utils.cjs +12 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.js +12 -0
- package/dist/utils.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHighlights-D6Jl6Woe.cjs","sources":["../node_modules/events/events.js","../node_modules/graphology/dist/graphology.mjs","../node_modules/graphology-utils/is-graph.js","../src/colors/nodeColors.ts","../src/colors/linkColors.ts","../src/colors/communityColors.ts","../src/graph/useGraphFilters.ts","../node_modules/graphology-utils/defaults.js","../node_modules/graphology-utils/infer-type.js","../node_modules/obliterator/iterator.js","../node_modules/mnemonist/utils/typed-arrays.js","../node_modules/mnemonist/sparse-map.js","../node_modules/mnemonist/sparse-queue-set.js","../node_modules/pandemonium/random-index.js","../node_modules/graphology-utils/getters.js","../node_modules/graphology-indices/louvain.js","../node_modules/graphology-communities-louvain/index.js","../src/graph/useCommunities.ts","../src/graph/useHighlights.ts"],"sourcesContent":["// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","import { EventEmitter } from 'events';\n\n/**\n * Graphology Utilities\n * =====================\n *\n * Collection of helpful functions used by the implementation.\n */\n\n/**\n * Object.assign-like polyfill.\n *\n * @param {object} target - First object.\n * @param {object} [...objects] - Objects to merge.\n * @return {object}\n */\nfunction assignPolyfill() {\n const target = arguments[0];\n\n for (let i = 1, l = arguments.length; i < l; i++) {\n if (!arguments[i]) continue;\n\n for (const k in arguments[i]) target[k] = arguments[i][k];\n }\n\n return target;\n}\n\nlet assign = assignPolyfill;\n\nif (typeof Object.assign === 'function') assign = Object.assign;\n\n/**\n * Function returning the first matching edge for given path.\n * Note: this function does not check the existence of source & target. This\n * must be performed by the caller.\n *\n * @param {Graph} graph - Target graph.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {string} type - Type of the edge (mixed, directed or undirected).\n * @return {string|null}\n */\nfunction getMatchingEdge(graph, source, target, type) {\n const sourceData = graph._nodes.get(source);\n\n let edge = null;\n\n if (!sourceData) return edge;\n\n if (type === 'mixed') {\n edge =\n (sourceData.out && sourceData.out[target]) ||\n (sourceData.undirected && sourceData.undirected[target]);\n } else if (type === 'directed') {\n edge = sourceData.out && sourceData.out[target];\n } else {\n edge = sourceData.undirected && sourceData.undirected[target];\n }\n\n return edge;\n}\n\n/**\n * Checks whether the given value is a plain object.\n *\n * @param {mixed} value - Target value.\n * @return {boolean}\n */\nfunction isPlainObject(value) {\n // NOTE: as per https://github.com/graphology/graphology/issues/149\n // this function has been loosened not to reject object instances\n // coming from other JavaScript contexts. It has also been chosen\n // not to improve it to avoid obvious false positives and avoid\n // taking a performance hit. People should really use TypeScript\n // if they want to avoid feeding subtly irrelvant attribute objects.\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Checks whether the given object is empty.\n *\n * @param {object} o - Target Object.\n * @return {boolean}\n */\nfunction isEmpty(o) {\n let k;\n\n for (k in o) return false;\n\n return true;\n}\n\n/**\n * Creates a \"private\" property for the given member name by concealing it\n * using the `enumerable` option.\n *\n * @param {object} target - Target object.\n * @param {string} name - Member name.\n */\nfunction privateProperty(target, name, value) {\n Object.defineProperty(target, name, {\n enumerable: false,\n configurable: false,\n writable: true,\n value\n });\n}\n\n/**\n * Creates a read-only property for the given member name & the given getter.\n *\n * @param {object} target - Target object.\n * @param {string} name - Member name.\n * @param {mixed} value - The attached getter or fixed value.\n */\nfunction readOnlyProperty(target, name, value) {\n const descriptor = {\n enumerable: true,\n configurable: true\n };\n\n if (typeof value === 'function') {\n descriptor.get = value;\n } else {\n descriptor.value = value;\n descriptor.writable = false;\n }\n\n Object.defineProperty(target, name, descriptor);\n}\n\n/**\n * Returns whether the given object constitute valid hints.\n *\n * @param {object} hints - Target object.\n */\nfunction validateHints(hints) {\n if (!isPlainObject(hints)) return false;\n\n if (hints.attributes && !Array.isArray(hints.attributes)) return false;\n\n return true;\n}\n\n/**\n * Creates a function generating incremental ids for edges.\n *\n * @return {function}\n */\nfunction incrementalIdStartingFromRandomByte() {\n let i = Math.floor(Math.random() * 256) & 0xff;\n\n return () => {\n return i++;\n };\n}\n\n/**\n * Chains multiple iterators into a single iterator.\n *\n * @param {...Iterator} iterables\n * @returns {Iterator}\n */\nfunction chain() {\n const iterables = arguments;\n let current = null;\n let i = -1;\n\n return {\n [Symbol.iterator]() {\n return this;\n },\n next() {\n let step = null;\n\n do {\n if (current === null) {\n i++;\n if (i >= iterables.length) return {done: true};\n current = iterables[i][Symbol.iterator]();\n }\n step = current.next();\n if (step.done) {\n current = null;\n continue;\n }\n break;\n // eslint-disable-next-line no-constant-condition\n } while (true);\n\n return step;\n }\n };\n}\n\nfunction emptyIterator() {\n return {\n [Symbol.iterator]() {\n return this;\n },\n next() {\n return {done: true};\n }\n };\n}\n\n/**\n * Graphology Custom Errors\n * =========================\n *\n * Defining custom errors for ease of use & easy unit tests across\n * implementations (normalized typology rather than relying on error\n * messages to check whether the correct error was found).\n */\nclass GraphError extends Error {\n constructor(message) {\n super();\n this.name = 'GraphError';\n this.message = message;\n }\n}\n\nclass InvalidArgumentsGraphError extends GraphError {\n constructor(message) {\n super(message);\n this.name = 'InvalidArgumentsGraphError';\n\n // This is V8 specific to enhance stack readability\n if (typeof Error.captureStackTrace === 'function')\n Error.captureStackTrace(\n this,\n InvalidArgumentsGraphError.prototype.constructor\n );\n }\n}\n\nclass NotFoundGraphError extends GraphError {\n constructor(message) {\n super(message);\n this.name = 'NotFoundGraphError';\n\n // This is V8 specific to enhance stack readability\n if (typeof Error.captureStackTrace === 'function')\n Error.captureStackTrace(this, NotFoundGraphError.prototype.constructor);\n }\n}\n\nclass UsageGraphError extends GraphError {\n constructor(message) {\n super(message);\n this.name = 'UsageGraphError';\n\n // This is V8 specific to enhance stack readability\n if (typeof Error.captureStackTrace === 'function')\n Error.captureStackTrace(this, UsageGraphError.prototype.constructor);\n }\n}\n\n/**\n * Graphology Internal Data Classes\n * =================================\n *\n * Internal classes hopefully reduced to structs by engines & storing\n * necessary information for nodes & edges.\n *\n * Note that those classes don't rely on the `class` keyword to avoid some\n * cruft introduced by most of ES2015 transpilers.\n */\n\n/**\n * MixedNodeData class.\n *\n * @constructor\n * @param {string} string - The node's key.\n * @param {object} attributes - Node's attributes.\n */\nfunction MixedNodeData(key, attributes) {\n // Attributes\n this.key = key;\n this.attributes = attributes;\n\n this.clear();\n}\n\nMixedNodeData.prototype.clear = function () {\n // Degrees\n this.inDegree = 0;\n this.outDegree = 0;\n this.undirectedDegree = 0;\n this.undirectedLoops = 0;\n this.directedLoops = 0;\n\n // Indices\n this.in = {};\n this.out = {};\n this.undirected = {};\n};\n\n/**\n * DirectedNodeData class.\n *\n * @constructor\n * @param {string} string - The node's key.\n * @param {object} attributes - Node's attributes.\n */\nfunction DirectedNodeData(key, attributes) {\n // Attributes\n this.key = key;\n this.attributes = attributes;\n\n this.clear();\n}\n\nDirectedNodeData.prototype.clear = function () {\n // Degrees\n this.inDegree = 0;\n this.outDegree = 0;\n this.directedLoops = 0;\n\n // Indices\n this.in = {};\n this.out = {};\n};\n\n/**\n * UndirectedNodeData class.\n *\n * @constructor\n * @param {string} string - The node's key.\n * @param {object} attributes - Node's attributes.\n */\nfunction UndirectedNodeData(key, attributes) {\n // Attributes\n this.key = key;\n this.attributes = attributes;\n\n this.clear();\n}\n\nUndirectedNodeData.prototype.clear = function () {\n // Degrees\n this.undirectedDegree = 0;\n this.undirectedLoops = 0;\n\n // Indices\n this.undirected = {};\n};\n\n/**\n * EdgeData class.\n *\n * @constructor\n * @param {boolean} undirected - Whether the edge is undirected.\n * @param {string} string - The edge's key.\n * @param {string} source - Source of the edge.\n * @param {string} target - Target of the edge.\n * @param {object} attributes - Edge's attributes.\n */\nfunction EdgeData(undirected, key, source, target, attributes) {\n // Attributes\n this.key = key;\n this.attributes = attributes;\n this.undirected = undirected;\n\n // Extremities\n this.source = source;\n this.target = target;\n}\n\nEdgeData.prototype.attach = function () {\n let outKey = 'out';\n let inKey = 'in';\n\n if (this.undirected) outKey = inKey = 'undirected';\n\n const source = this.source.key;\n const target = this.target.key;\n\n // Handling source\n this.source[outKey][target] = this;\n\n if (this.undirected && source === target) return;\n\n // Handling target\n this.target[inKey][source] = this;\n};\n\nEdgeData.prototype.attachMulti = function () {\n let outKey = 'out';\n let inKey = 'in';\n\n const source = this.source.key;\n const target = this.target.key;\n\n if (this.undirected) outKey = inKey = 'undirected';\n\n // Handling source\n const adj = this.source[outKey];\n const head = adj[target];\n\n if (typeof head === 'undefined') {\n adj[target] = this;\n\n // Self-loop optimization\n if (!(this.undirected && source === target)) {\n // Handling target\n this.target[inKey][source] = this;\n }\n\n return;\n }\n\n // Prepending to doubly-linked list\n head.previous = this;\n this.next = head;\n\n // Pointing to new head\n // NOTE: use mutating swap later to avoid lookup?\n adj[target] = this;\n this.target[inKey][source] = this;\n};\n\nEdgeData.prototype.detach = function () {\n const source = this.source.key;\n const target = this.target.key;\n\n let outKey = 'out';\n let inKey = 'in';\n\n if (this.undirected) outKey = inKey = 'undirected';\n\n delete this.source[outKey][target];\n\n // No-op delete in case of undirected self-loop\n delete this.target[inKey][source];\n};\n\nEdgeData.prototype.detachMulti = function () {\n const source = this.source.key;\n const target = this.target.key;\n\n let outKey = 'out';\n let inKey = 'in';\n\n if (this.undirected) outKey = inKey = 'undirected';\n\n // Deleting from doubly-linked list\n if (this.previous === undefined) {\n // We are dealing with the head\n\n // Should we delete the adjacency entry because it is now empty?\n if (this.next === undefined) {\n delete this.source[outKey][target];\n\n // No-op delete in case of undirected self-loop\n delete this.target[inKey][source];\n } else {\n // Detaching\n this.next.previous = undefined;\n\n // NOTE: could avoid the lookups by creating a #.become mutating method\n this.source[outKey][target] = this.next;\n\n // No-op delete in case of undirected self-loop\n this.target[inKey][source] = this.next;\n }\n } else {\n // We are dealing with another list node\n this.previous.next = this.next;\n\n // If not last\n if (this.next !== undefined) {\n this.next.previous = this.previous;\n }\n }\n};\n\n/**\n * Graphology Node Attributes methods\n * ===================================\n */\n\nconst NODE = 0;\nconst SOURCE = 1;\nconst TARGET = 2;\nconst OPPOSITE = 3;\n\nfunction findRelevantNodeData(\n graph,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1,\n add2\n) {\n let nodeData, edgeData, arg1, arg2;\n\n nodeOrEdge = '' + nodeOrEdge;\n\n if (mode === NODE) {\n nodeData = graph._nodes.get(nodeOrEdge);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${nodeOrEdge}\" node in the graph.`\n );\n\n arg1 = nameOrEdge;\n arg2 = add1;\n } else if (mode === OPPOSITE) {\n nameOrEdge = '' + nameOrEdge;\n\n edgeData = graph._edges.get(nameOrEdge);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${nameOrEdge}\" edge in the graph.`\n );\n\n const source = edgeData.source.key;\n const target = edgeData.target.key;\n\n if (nodeOrEdge === source) {\n nodeData = edgeData.target;\n } else if (nodeOrEdge === target) {\n nodeData = edgeData.source;\n } else {\n throw new NotFoundGraphError(\n `Graph.${method}: the \"${nodeOrEdge}\" node is not attached to the \"${nameOrEdge}\" edge (${source}, ${target}).`\n );\n }\n\n arg1 = add1;\n arg2 = add2;\n } else {\n edgeData = graph._edges.get(nodeOrEdge);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${nodeOrEdge}\" edge in the graph.`\n );\n\n if (mode === SOURCE) {\n nodeData = edgeData.source;\n } else {\n nodeData = edgeData.target;\n }\n\n arg1 = nameOrEdge;\n arg2 = add1;\n }\n\n return [nodeData, arg1, arg2];\n}\n\nfunction attachNodeAttributeGetter(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, name] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n return data.attributes[name];\n };\n}\n\nfunction attachNodeAttributesGetter(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge) {\n const [data] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge\n );\n\n return data.attributes;\n };\n}\n\nfunction attachNodeAttributeChecker(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, name] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n return data.attributes.hasOwnProperty(name);\n };\n}\n\nfunction attachNodeAttributeSetter(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1, add2) {\n const [data, name, value] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1,\n add2\n );\n\n data.attributes[name] = value;\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'set',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributeUpdater(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1, add2) {\n const [data, name, updater] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1,\n add2\n );\n\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: updater should be a function.`\n );\n\n const attributes = data.attributes;\n const value = updater(attributes[name]);\n\n attributes[name] = value;\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'set',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributeRemover(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, name] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n delete data.attributes[name];\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'remove',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributesReplacer(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, attributes] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided attributes are not a plain object.`\n );\n\n data.attributes = attributes;\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'replace',\n attributes: data.attributes\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributesMerger(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, attributes] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided attributes are not a plain object.`\n );\n\n assign(data.attributes, attributes);\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'merge',\n attributes: data.attributes,\n data: attributes\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributesUpdater(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, updater] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided updater is not a function.`\n );\n\n data.attributes = updater(data.attributes);\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'update',\n attributes: data.attributes\n });\n\n return this;\n };\n}\n\n/**\n * List of methods to attach.\n */\nconst NODE_ATTRIBUTES_METHODS = [\n {\n name: element => `get${element}Attribute`,\n attacher: attachNodeAttributeGetter\n },\n {\n name: element => `get${element}Attributes`,\n attacher: attachNodeAttributesGetter\n },\n {\n name: element => `has${element}Attribute`,\n attacher: attachNodeAttributeChecker\n },\n {\n name: element => `set${element}Attribute`,\n attacher: attachNodeAttributeSetter\n },\n {\n name: element => `update${element}Attribute`,\n attacher: attachNodeAttributeUpdater\n },\n {\n name: element => `remove${element}Attribute`,\n attacher: attachNodeAttributeRemover\n },\n {\n name: element => `replace${element}Attributes`,\n attacher: attachNodeAttributesReplacer\n },\n {\n name: element => `merge${element}Attributes`,\n attacher: attachNodeAttributesMerger\n },\n {\n name: element => `update${element}Attributes`,\n attacher: attachNodeAttributesUpdater\n }\n];\n\n/**\n * Attach every attributes-related methods to a Graph class.\n *\n * @param {function} Graph - Target class.\n */\nfunction attachNodeAttributesMethods(Graph) {\n NODE_ATTRIBUTES_METHODS.forEach(function ({name, attacher}) {\n // For nodes\n attacher(Graph, name('Node'), NODE);\n\n // For sources\n attacher(Graph, name('Source'), SOURCE);\n\n // For targets\n attacher(Graph, name('Target'), TARGET);\n\n // For opposites\n attacher(Graph, name('Opposite'), OPPOSITE);\n });\n}\n\n/**\n * Graphology Edge Attributes methods\n * ===================================\n */\n\n/**\n * Attach an attribute getter method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeGetter(Class, method, type) {\n /**\n * Get the desired attribute for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n *\n * @return {mixed} - The attribute's value.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n return data.attributes[name];\n };\n}\n\n/**\n * Attach an attributes getter method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributesGetter(Class, method, type) {\n /**\n * Retrieves all the target element's attributes.\n *\n * Arity 2:\n * @param {any} element - Target element.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n *\n * @return {object} - The element's attributes.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 1) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`\n );\n\n const source = '' + element,\n target = '' + arguments[1];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n return data.attributes;\n };\n}\n\n/**\n * Attach an attribute checker method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeChecker(Class, method, type) {\n /**\n * Checks whether the desired attribute is set for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n *\n * @return {boolean}\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n return data.attributes.hasOwnProperty(name);\n };\n}\n\n/**\n * Attach an attribute setter method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeSetter(Class, method, type) {\n /**\n * Set the desired attribute for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n * @param {mixed} value - New attribute value.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n * @param {mixed} value - New attribute value.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name, value) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 3) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n value = arguments[3];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n data.attributes[name] = value;\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'set',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute updater method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeUpdater(Class, method, type) {\n /**\n * Update the desired attribute for the given element (node or edge) using\n * the provided function.\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n * @param {function} updater - Updater function.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n * @param {function} updater - Updater function.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name, updater) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 3) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n updater = arguments[3];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: updater should be a function.`\n );\n\n data.attributes[name] = updater(data.attributes[name]);\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'set',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute remover method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeRemover(Class, method, type) {\n /**\n * Remove the desired attribute for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n delete data.attributes[name];\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'remove',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute replacer method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributesReplacer(Class, method, type) {\n /**\n * Replace the attributes for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {object} attributes - New attributes.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {object} attributes - New attributes.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, attributes) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`\n );\n\n const source = '' + element,\n target = '' + attributes;\n\n attributes = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided attributes are not a plain object.`\n );\n\n data.attributes = attributes;\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'replace',\n attributes: data.attributes\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute merger method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributesMerger(Class, method, type) {\n /**\n * Merge the attributes for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {object} attributes - Attributes to merge.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {object} attributes - Attributes to merge.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, attributes) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`\n );\n\n const source = '' + element,\n target = '' + attributes;\n\n attributes = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided attributes are not a plain object.`\n );\n\n assign(data.attributes, attributes);\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'merge',\n attributes: data.attributes,\n data: attributes\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute updater method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributesUpdater(Class, method, type) {\n /**\n * Update the attributes of the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {function} updater - Updater function.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {function} updater - Updater function.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, updater) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`\n );\n\n const source = '' + element,\n target = '' + updater;\n\n updater = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided updater is not a function.`\n );\n\n data.attributes = updater(data.attributes);\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'update',\n attributes: data.attributes\n });\n\n return this;\n };\n}\n\n/**\n * List of methods to attach.\n */\nconst EDGE_ATTRIBUTES_METHODS = [\n {\n name: element => `get${element}Attribute`,\n attacher: attachEdgeAttributeGetter\n },\n {\n name: element => `get${element}Attributes`,\n attacher: attachEdgeAttributesGetter\n },\n {\n name: element => `has${element}Attribute`,\n attacher: attachEdgeAttributeChecker\n },\n {\n name: element => `set${element}Attribute`,\n attacher: attachEdgeAttributeSetter\n },\n {\n name: element => `update${element}Attribute`,\n attacher: attachEdgeAttributeUpdater\n },\n {\n name: element => `remove${element}Attribute`,\n attacher: attachEdgeAttributeRemover\n },\n {\n name: element => `replace${element}Attributes`,\n attacher: attachEdgeAttributesReplacer\n },\n {\n name: element => `merge${element}Attributes`,\n attacher: attachEdgeAttributesMerger\n },\n {\n name: element => `update${element}Attributes`,\n attacher: attachEdgeAttributesUpdater\n }\n];\n\n/**\n * Attach every attributes-related methods to a Graph class.\n *\n * @param {function} Graph - Target class.\n */\nfunction attachEdgeAttributesMethods(Graph) {\n EDGE_ATTRIBUTES_METHODS.forEach(function ({name, attacher}) {\n // For edges\n attacher(Graph, name('Edge'), 'mixed');\n\n // For directed edges\n attacher(Graph, name('DirectedEdge'), 'directed');\n\n // For undirected edges\n attacher(Graph, name('UndirectedEdge'), 'undirected');\n });\n}\n\n/**\n * Graphology Edge Iteration\n * ==========================\n *\n * Attaching some methods to the Graph class to be able to iterate over a\n * graph's edges.\n */\n\n/**\n * Definitions.\n */\nconst EDGES_ITERATION = [\n {\n name: 'edges',\n type: 'mixed'\n },\n {\n name: 'inEdges',\n type: 'directed',\n direction: 'in'\n },\n {\n name: 'outEdges',\n type: 'directed',\n direction: 'out'\n },\n {\n name: 'inboundEdges',\n type: 'mixed',\n direction: 'in'\n },\n {\n name: 'outboundEdges',\n type: 'mixed',\n direction: 'out'\n },\n {\n name: 'directedEdges',\n type: 'directed'\n },\n {\n name: 'undirectedEdges',\n type: 'undirected'\n }\n];\n\n/**\n * Function iterating over edges from the given object to match one of them.\n *\n * @param {object} object - Target object.\n * @param {function} callback - Function to call.\n */\nfunction forEachSimple(breakable, object, callback, avoid) {\n let shouldBreak = false;\n\n for (const k in object) {\n if (k === avoid) continue;\n\n const edgeData = object[k];\n\n shouldBreak = callback(\n edgeData.key,\n edgeData.attributes,\n edgeData.source.key,\n edgeData.target.key,\n edgeData.source.attributes,\n edgeData.target.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData.key;\n }\n\n return;\n}\n\nfunction forEachMulti(breakable, object, callback, avoid) {\n let edgeData, source, target;\n\n let shouldBreak = false;\n\n for (const k in object) {\n if (k === avoid) continue;\n\n edgeData = object[k];\n\n do {\n source = edgeData.source;\n target = edgeData.target;\n\n shouldBreak = callback(\n edgeData.key,\n edgeData.attributes,\n source.key,\n target.key,\n source.attributes,\n target.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData.key;\n\n edgeData = edgeData.next;\n } while (edgeData !== undefined);\n }\n\n return;\n}\n\n/**\n * Function returning an iterator over edges from the given object.\n *\n * @param {object} object - Target object.\n * @return {Iterator}\n */\nfunction createIterator(object, avoid) {\n const keys = Object.keys(object);\n const l = keys.length;\n\n let edgeData;\n let i = 0;\n\n return {\n [Symbol.iterator]() {\n return this;\n },\n next() {\n do {\n if (!edgeData) {\n if (i >= l) return {done: true};\n\n const k = keys[i++];\n\n if (k === avoid) {\n edgeData = undefined;\n continue;\n }\n\n edgeData = object[k];\n } else {\n edgeData = edgeData.next;\n }\n } while (!edgeData);\n\n return {\n done: false,\n value: {\n edge: edgeData.key,\n attributes: edgeData.attributes,\n source: edgeData.source.key,\n target: edgeData.target.key,\n sourceAttributes: edgeData.source.attributes,\n targetAttributes: edgeData.target.attributes,\n undirected: edgeData.undirected\n }\n };\n }\n };\n}\n\n/**\n * Function iterating over the egdes from the object at given key to match\n * one of them.\n *\n * @param {object} object - Target object.\n * @param {mixed} k - Neighbor key.\n * @param {function} callback - Callback to use.\n */\nfunction forEachForKeySimple(breakable, object, k, callback) {\n const edgeData = object[k];\n\n if (!edgeData) return;\n\n const sourceData = edgeData.source;\n const targetData = edgeData.target;\n\n if (\n callback(\n edgeData.key,\n edgeData.attributes,\n sourceData.key,\n targetData.key,\n sourceData.attributes,\n targetData.attributes,\n edgeData.undirected\n ) &&\n breakable\n )\n return edgeData.key;\n}\n\nfunction forEachForKeyMulti(breakable, object, k, callback) {\n let edgeData = object[k];\n\n if (!edgeData) return;\n\n let shouldBreak = false;\n\n do {\n shouldBreak = callback(\n edgeData.key,\n edgeData.attributes,\n edgeData.source.key,\n edgeData.target.key,\n edgeData.source.attributes,\n edgeData.target.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData.key;\n\n edgeData = edgeData.next;\n } while (edgeData !== undefined);\n\n return;\n}\n\n/**\n * Function returning an iterator over the egdes from the object at given key.\n *\n * @param {object} object - Target object.\n * @param {mixed} k - Neighbor key.\n * @return {Iterator}\n */\nfunction createIteratorForKey(object, k) {\n let edgeData = object[k];\n\n if (edgeData.next !== undefined) {\n return {\n [Symbol.iterator]() {\n return this;\n },\n next() {\n if (!edgeData) return {done: true};\n\n const value = {\n edge: edgeData.key,\n attributes: edgeData.attributes,\n source: edgeData.source.key,\n target: edgeData.target.key,\n sourceAttributes: edgeData.source.attributes,\n targetAttributes: edgeData.target.attributes,\n undirected: edgeData.undirected\n };\n\n edgeData = edgeData.next;\n\n return {\n done: false,\n value\n };\n }\n };\n }\n\n let done = false;\n return {\n [Symbol.iterator]() {\n return this;\n },\n next() {\n if (done === true) return {done: true};\n done = true;\n return {\n done: false,\n value: {\n edge: edgeData.key,\n attributes: edgeData.attributes,\n source: edgeData.source.key,\n target: edgeData.target.key,\n sourceAttributes: edgeData.source.attributes,\n targetAttributes: edgeData.target.attributes,\n undirected: edgeData.undirected\n }\n };\n }\n };\n}\n\n/**\n * Function creating an array of edges for the given type.\n *\n * @param {Graph} graph - Target Graph instance.\n * @param {string} type - Type of edges to retrieve.\n * @return {array} - Array of edges.\n */\nfunction createEdgeArray(graph, type) {\n if (graph.size === 0) return [];\n\n if (type === 'mixed' || type === graph.type) {\n return Array.from(graph._edges.keys());\n }\n\n const size =\n type === 'undirected' ? graph.undirectedSize : graph.directedSize;\n\n const list = new Array(size),\n mask = type === 'undirected';\n\n const iterator = graph._edges.values();\n\n let i = 0;\n let step, data;\n\n while (((step = iterator.next()), step.done !== true)) {\n data = step.value;\n\n if (data.undirected === mask) list[i++] = data.key;\n }\n\n return list;\n}\n\n/**\n * Function iterating over a graph's edges using a callback to match one of\n * them.\n *\n * @param {Graph} graph - Target Graph instance.\n * @param {string} type - Type of edges to retrieve.\n * @param {function} callback - Function to call.\n */\nfunction forEachEdge(breakable, graph, type, callback) {\n if (graph.size === 0) return;\n\n const shouldFilter = type !== 'mixed' && type !== graph.type;\n const mask = type === 'undirected';\n\n let step, data;\n let shouldBreak = false;\n const iterator = graph._edges.values();\n\n while (((step = iterator.next()), step.done !== true)) {\n data = step.value;\n\n if (shouldFilter && data.undirected !== mask) continue;\n\n const {key, attributes, source, target} = data;\n\n shouldBreak = callback(\n key,\n attributes,\n source.key,\n target.key,\n source.attributes,\n target.attributes,\n data.undirected\n );\n\n if (breakable && shouldBreak) return key;\n }\n\n return;\n}\n\n/**\n * Function creating an iterator of edges for the given type.\n *\n * @param {Graph} graph - Target Graph instance.\n * @param {string} type - Type of edges to retrieve.\n * @return {Iterator}\n */\nfunction createEdgeIterator(graph, type) {\n if (graph.size === 0) return emptyIterator();\n\n const shouldFilter = type !== 'mixed' && type !== graph.type;\n const mask = type === 'undirected';\n\n const iterator = graph._edges.values();\n\n return {\n [Symbol.iterator]() {\n return this;\n },\n next() {\n let step, data;\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n step = iterator.next();\n\n if (step.done) return step;\n\n data = step.value;\n\n if (shouldFilter && data.undirected !== mask) continue;\n\n break;\n }\n\n const value = {\n edge: data.key,\n attributes: data.attributes,\n source: data.source.key,\n target: data.target.key,\n sourceAttributes: data.source.attributes,\n targetAttributes: data.target.attributes,\n undirected: data.undirected\n };\n\n return {value, done: false};\n }\n };\n}\n\n/**\n * Function iterating over a node's edges using a callback to match one of them.\n *\n * @param {boolean} multi - Whether the graph is multi or not.\n * @param {string} type - Type of edges to retrieve.\n * @param {string} direction - In or out?\n * @param {any} nodeData - Target node's data.\n * @param {function} callback - Function to call.\n */\nfunction forEachEdgeForNode(\n breakable,\n multi,\n type,\n direction,\n nodeData,\n callback\n) {\n const fn = multi ? forEachMulti : forEachSimple;\n\n let found;\n\n if (type !== 'undirected') {\n if (direction !== 'out') {\n found = fn(breakable, nodeData.in, callback);\n\n if (breakable && found) return found;\n }\n if (direction !== 'in') {\n found = fn(\n breakable,\n nodeData.out,\n callback,\n !direction ? nodeData.key : undefined\n );\n\n if (breakable && found) return found;\n }\n }\n\n if (type !== 'directed') {\n found = fn(breakable, nodeData.undirected, callback);\n\n if (breakable && found) return found;\n }\n\n return;\n}\n\n/**\n * Function creating an array of edges for the given type & the given node.\n *\n * @param {boolean} multi - Whether the graph is multi or not.\n * @param {string} type - Type of edges to retrieve.\n * @param {string} direction - In or out?\n * @param {any} nodeData - Target node's data.\n * @return {array} - Array of edges.\n */\nfunction createEdgeArrayForNode(multi, type, direction, nodeData) {\n const edges = []; // TODO: possibility to know size beforehand or factorize with map\n\n forEachEdgeForNode(false, multi, type, direction, nodeData, function (key) {\n edges.push(key);\n });\n\n return edges;\n}\n\n/**\n * Function iterating over a node's edges using a callback.\n *\n * @param {string} type - Type of edges to retrieve.\n * @param {string} direction - In or out?\n * @param {any} nodeData - Target node's data.\n * @return {Iterator}\n */\nfunction createEdgeIteratorForNode(type, direction, nodeData) {\n let iterator = emptyIterator();\n\n if (type !== 'undirected') {\n if (direction !== 'out' && typeof nodeData.in !== 'undefined')\n iterator = chain(iterator, createIterator(nodeData.in));\n if (direction !== 'in' && typeof nodeData.out !== 'undefined')\n iterator = chain(\n iterator,\n createIterator(nodeData.out, !direction ? nodeData.key : undefined)\n );\n }\n\n if (type !== 'directed' && typeof nodeData.undirected !== 'undefined') {\n iterator = chain(iterator, createIterator(nodeData.undirected));\n }\n\n return iterator;\n}\n\n/**\n * Function iterating over edges for the given path using a callback to match\n * one of them.\n *\n * @param {string} type - Type of edges to retrieve.\n * @param {boolean} multi - Whether the graph is multi.\n * @param {string} direction - In or out?\n * @param {NodeData} sourceData - Source node's data.\n * @param {string} target - Target node.\n * @param {function} callback - Function to call.\n */\nfunction forEachEdgeForPath(\n breakable,\n type,\n multi,\n direction,\n sourceData,\n target,\n callback\n) {\n const fn = multi ? forEachForKeyMulti : forEachForKeySimple;\n\n let found;\n\n if (type !== 'undirected') {\n if (typeof sourceData.in !== 'undefined' && direction !== 'out') {\n found = fn(breakable, sourceData.in, target, callback);\n\n if (breakable && found) return found;\n }\n\n if (\n typeof sourceData.out !== 'undefined' &&\n direction !== 'in' &&\n (direction || sourceData.key !== target)\n ) {\n found = fn(breakable, sourceData.out, target, callback);\n\n if (breakable && found) return found;\n }\n }\n\n if (type !== 'directed') {\n if (typeof sourceData.undirected !== 'undefined') {\n found = fn(breakable, sourceData.undirected, target, callback);\n\n if (breakable && found) return found;\n }\n }\n\n return;\n}\n\n/**\n * Function creating an array of edges for the given path.\n *\n * @param {string} type - Type of edges to retrieve.\n * @param {boolean} multi - Whether the graph is multi.\n * @param {string} direction - In or out?\n * @param {NodeData} sourceData - Source node's data.\n * @param {any} target - Target node.\n * @return {array} - Array of edges.\n */\nfunction createEdgeArrayForPath(type, multi, direction, sourceData, target) {\n const edges = []; // TODO: possibility to know size beforehand or factorize with map\n\n forEachEdgeForPath(\n false,\n type,\n multi,\n direction,\n sourceData,\n target,\n function (key) {\n edges.push(key);\n }\n );\n\n return edges;\n}\n\n/**\n * Function returning an iterator over edges for the given path.\n *\n * @param {string} type - Type of edges to retrieve.\n * @param {string} direction - In or out?\n * @param {NodeData} sourceData - Source node's data.\n * @param {string} target - Target node.\n * @param {function} callback - Function to call.\n */\nfunction createEdgeIteratorForPath(type, direction, sourceData, target) {\n let iterator = emptyIterator();\n\n if (type !== 'undirected') {\n if (\n typeof sourceData.in !== 'undefined' &&\n direction !== 'out' &&\n target in sourceData.in\n )\n iterator = chain(iterator, createIteratorForKey(sourceData.in, target));\n\n if (\n typeof sourceData.out !== 'undefined' &&\n direction !== 'in' &&\n target in sourceData.out &&\n (direction || sourceData.key !== target)\n )\n iterator = chain(iterator, createIteratorForKey(sourceData.out, target));\n }\n\n if (type !== 'directed') {\n if (\n typeof sourceData.undirected !== 'undefined' &&\n target in sourceData.undirected\n )\n iterator = chain(\n iterator,\n createIteratorForKey(sourceData.undirected, target)\n );\n }\n\n return iterator;\n}\n\n/**\n * Function attaching an edge array creator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachEdgeArrayCreator(Class, description) {\n const {name, type, direction} = description;\n\n /**\n * Function returning an array of certain edges.\n *\n * Arity 0: Return all the relevant edges.\n *\n * Arity 1: Return all of a node's relevant edges.\n * @param {any} node - Target node.\n *\n * Arity 2: Return the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {array|number} - The edges or the number of edges.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[name] = function (source, target) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return [];\n\n if (!arguments.length) return createEdgeArray(this, type);\n\n if (arguments.length === 1) {\n source = '' + source;\n\n const nodeData = this._nodes.get(source);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${source}\" node in the graph.`\n );\n\n // Iterating over a node's edges\n return createEdgeArrayForNode(\n this.multi,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData\n );\n }\n\n if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${target}\" target node in the graph.`\n );\n\n // Iterating over the edges between source & target\n return createEdgeArrayForPath(\n type,\n this.multi,\n direction,\n sourceData,\n target\n );\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`\n );\n };\n}\n\n/**\n * Function attaching a edge callback iterator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachForEachEdge(Class, description) {\n const {name, type, direction} = description;\n\n const forEachName = 'forEach' + name[0].toUpperCase() + name.slice(1, -1);\n\n /**\n * Function iterating over the graph's relevant edges by applying the given\n * callback.\n *\n * Arity 1: Iterate over all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[forEachName] = function (source, target, callback) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type) return;\n\n if (arguments.length === 1) {\n callback = source;\n return forEachEdge(false, this, type, callback);\n }\n\n if (arguments.length === 2) {\n source = '' + source;\n callback = target;\n\n const nodeData = this._nodes.get(source);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${forEachName}: could not find the \"${source}\" node in the graph.`\n );\n\n // Iterating over a node's edges\n // TODO: maybe attach the sub method to the instance dynamically?\n return forEachEdgeForNode(\n false,\n this.multi,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData,\n callback\n );\n }\n\n if (arguments.length === 3) {\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${forEachName}: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.${forEachName}: could not find the \"${target}\" target node in the graph.`\n );\n\n // Iterating over the edges between source & target\n return forEachEdgeForPath(\n false,\n type,\n this.multi,\n direction,\n sourceData,\n target,\n callback\n );\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.${forEachName}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`\n );\n };\n\n /**\n * Function mapping the graph's relevant edges by applying the given\n * callback.\n *\n * Arity 1: Map all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Map all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Map the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const mapName = 'map' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[mapName] = function () {\n const args = Array.prototype.slice.call(arguments);\n const callback = args.pop();\n\n let result;\n\n // We know the result length beforehand\n if (args.length === 0) {\n let length = 0;\n\n if (type !== 'directed') length += this.undirectedSize;\n if (type !== 'undirected') length += this.directedSize;\n\n result = new Array(length);\n\n let i = 0;\n\n args.push((e, ea, s, t, sa, ta, u) => {\n result[i++] = callback(e, ea, s, t, sa, ta, u);\n });\n }\n\n // We don't know the result length beforehand\n // TODO: we can in some instances of simple graphs, knowing degree\n else {\n result = [];\n\n args.push((e, ea, s, t, sa, ta, u) => {\n result.push(callback(e, ea, s, t, sa, ta, u));\n });\n }\n\n this[forEachName].apply(this, args);\n\n return result;\n };\n\n /**\n * Function filtering the graph's relevant edges using the provided predicate\n * function.\n *\n * Arity 1: Filter all the relevant edges.\n * @param {function} predicate - Predicate to use.\n *\n * Arity 2: Filter all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} predicate - Predicate to use.\n *\n * Arity 3: Filter the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} predicate - Predicate to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const filterName = 'filter' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[filterName] = function () {\n const args = Array.prototype.slice.call(arguments);\n const callback = args.pop();\n\n const result = [];\n\n args.push((e, ea, s, t, sa, ta, u) => {\n if (callback(e, ea, s, t, sa, ta, u)) result.push(e);\n });\n\n this[forEachName].apply(this, args);\n\n return result;\n };\n\n /**\n * Function reducing the graph's relevant edges using the provided accumulator\n * function.\n *\n * Arity 1: Reduce all the relevant edges.\n * @param {function} accumulator - Accumulator to use.\n * @param {any} initialValue - Initial value.\n *\n * Arity 2: Reduce all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} accumulator - Accumulator to use.\n * @param {any} initialValue - Initial value.\n *\n * Arity 3: Reduce the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} accumulator - Accumulator to use.\n * @param {any} initialValue - Initial value.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const reduceName = 'reduce' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[reduceName] = function () {\n let args = Array.prototype.slice.call(arguments);\n\n if (args.length < 2 || args.length > 4) {\n throw new InvalidArgumentsGraphError(\n `Graph.${reduceName}: invalid number of arguments (expecting 2, 3 or 4 and got ${args.length}).`\n );\n }\n\n if (\n typeof args[args.length - 1] === 'function' &&\n typeof args[args.length - 2] !== 'function'\n ) {\n throw new InvalidArgumentsGraphError(\n `Graph.${reduceName}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`\n );\n }\n\n let callback;\n let initialValue;\n\n if (args.length === 2) {\n callback = args[0];\n initialValue = args[1];\n args = [];\n } else if (args.length === 3) {\n callback = args[1];\n initialValue = args[2];\n args = [args[0]];\n } else if (args.length === 4) {\n callback = args[2];\n initialValue = args[3];\n args = [args[0], args[1]];\n }\n\n let accumulator = initialValue;\n\n args.push((e, ea, s, t, sa, ta, u) => {\n accumulator = callback(accumulator, e, ea, s, t, sa, ta, u);\n });\n\n this[forEachName].apply(this, args);\n\n return accumulator;\n };\n}\n\n/**\n * Function attaching a breakable edge callback iterator method to the Graph\n * prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachFindEdge(Class, description) {\n const {name, type, direction} = description;\n\n const findEdgeName = 'find' + name[0].toUpperCase() + name.slice(1, -1);\n\n /**\n * Function iterating over the graph's relevant edges in order to match\n * one of them using the provided predicate function.\n *\n * Arity 1: Iterate over all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[findEdgeName] = function (source, target, callback) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return false;\n\n if (arguments.length === 1) {\n callback = source;\n return forEachEdge(true, this, type, callback);\n }\n\n if (arguments.length === 2) {\n source = '' + source;\n callback = target;\n\n const nodeData = this._nodes.get(source);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${findEdgeName}: could not find the \"${source}\" node in the graph.`\n );\n\n // Iterating over a node's edges\n // TODO: maybe attach the sub method to the instance dynamically?\n return forEachEdgeForNode(\n true,\n this.multi,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData,\n callback\n );\n }\n\n if (arguments.length === 3) {\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${findEdgeName}: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.${findEdgeName}: could not find the \"${target}\" target node in the graph.`\n );\n\n // Iterating over the edges between source & target\n return forEachEdgeForPath(\n true,\n type,\n this.multi,\n direction,\n sourceData,\n target,\n callback\n );\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.${findEdgeName}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`\n );\n };\n\n /**\n * Function iterating over the graph's relevant edges in order to assert\n * whether any one of them matches the provided predicate function.\n *\n * Arity 1: Iterate over all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const someName = 'some' + name[0].toUpperCase() + name.slice(1, -1);\n\n Class.prototype[someName] = function () {\n const args = Array.prototype.slice.call(arguments);\n const callback = args.pop();\n\n args.push((e, ea, s, t, sa, ta, u) => {\n return callback(e, ea, s, t, sa, ta, u);\n });\n\n const found = this[findEdgeName].apply(this, args);\n\n if (found) return true;\n\n return false;\n };\n\n /**\n * Function iterating over the graph's relevant edges in order to assert\n * whether all of them matche the provided predicate function.\n *\n * Arity 1: Iterate over all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const everyName = 'every' + name[0].toUpperCase() + name.slice(1, -1);\n\n Class.prototype[everyName] = function () {\n const args = Array.prototype.slice.call(arguments);\n const callback = args.pop();\n\n args.push((e, ea, s, t, sa, ta, u) => {\n return !callback(e, ea, s, t, sa, ta, u);\n });\n\n const found = this[findEdgeName].apply(this, args);\n\n if (found) return false;\n\n return true;\n };\n}\n\n/**\n * Function attaching an edge iterator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachEdgeIteratorCreator(Class, description) {\n const {name: originalName, type, direction} = description;\n\n const name = originalName.slice(0, -1) + 'Entries';\n\n /**\n * Function returning an iterator over the graph's edges.\n *\n * Arity 0: Iterate over all the relevant edges.\n *\n * Arity 1: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n *\n * Arity 2: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {array|number} - The edges or the number of edges.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[name] = function (source, target) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return emptyIterator();\n\n if (!arguments.length) return createEdgeIterator(this, type);\n\n if (arguments.length === 1) {\n source = '' + source;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${source}\" node in the graph.`\n );\n\n // Iterating over a node's edges\n return createEdgeIteratorForNode(type, direction, sourceData);\n }\n\n if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${target}\" target node in the graph.`\n );\n\n // Iterating over the edges between source & target\n return createEdgeIteratorForPath(type, direction, sourceData, target);\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`\n );\n };\n}\n\n/**\n * Function attaching every edge iteration method to the Graph class.\n *\n * @param {function} Graph - Graph class.\n */\nfunction attachEdgeIterationMethods(Graph) {\n EDGES_ITERATION.forEach(description => {\n attachEdgeArrayCreator(Graph, description);\n attachForEachEdge(Graph, description);\n attachFindEdge(Graph, description);\n attachEdgeIteratorCreator(Graph, description);\n });\n}\n\n/**\n * Graphology Neighbor Iteration\n * ==============================\n *\n * Attaching some methods to the Graph class to be able to iterate over\n * neighbors.\n */\n\n/**\n * Definitions.\n */\nconst NEIGHBORS_ITERATION = [\n {\n name: 'neighbors',\n type: 'mixed'\n },\n {\n name: 'inNeighbors',\n type: 'directed',\n direction: 'in'\n },\n {\n name: 'outNeighbors',\n type: 'directed',\n direction: 'out'\n },\n {\n name: 'inboundNeighbors',\n type: 'mixed',\n direction: 'in'\n },\n {\n name: 'outboundNeighbors',\n type: 'mixed',\n direction: 'out'\n },\n {\n name: 'directedNeighbors',\n type: 'directed'\n },\n {\n name: 'undirectedNeighbors',\n type: 'undirected'\n }\n];\n\n/**\n * Helpers.\n */\nfunction CompositeSetWrapper() {\n this.A = null;\n this.B = null;\n}\n\nCompositeSetWrapper.prototype.wrap = function (set) {\n if (this.A === null) this.A = set;\n else if (this.B === null) this.B = set;\n};\n\nCompositeSetWrapper.prototype.has = function (key) {\n if (this.A !== null && key in this.A) return true;\n if (this.B !== null && key in this.B) return true;\n return false;\n};\n\n/**\n * Function iterating over the given node's relevant neighbors to match\n * one of them using a predicated function.\n *\n * @param {string} type - Type of neighbors.\n * @param {string} direction - Direction.\n * @param {any} nodeData - Target node's data.\n * @param {function} callback - Callback to use.\n */\nfunction forEachInObjectOnce(breakable, visited, nodeData, object, callback) {\n for (const k in object) {\n const edgeData = object[k];\n\n const sourceData = edgeData.source;\n const targetData = edgeData.target;\n\n const neighborData = sourceData === nodeData ? targetData : sourceData;\n\n if (visited && visited.has(neighborData.key)) continue;\n\n const shouldBreak = callback(neighborData.key, neighborData.attributes);\n\n if (breakable && shouldBreak) return neighborData.key;\n }\n\n return;\n}\n\nfunction forEachNeighbor(breakable, type, direction, nodeData, callback) {\n // If we want only undirected or in or out, we can roll some optimizations\n if (type !== 'mixed') {\n if (type === 'undirected')\n return forEachInObjectOnce(\n breakable,\n null,\n nodeData,\n nodeData.undirected,\n callback\n );\n\n if (typeof direction === 'string')\n return forEachInObjectOnce(\n breakable,\n null,\n nodeData,\n nodeData[direction],\n callback\n );\n }\n\n // Else we need to keep a set of neighbors not to return duplicates\n // We cheat by querying the other adjacencies\n const visited = new CompositeSetWrapper();\n\n let found;\n\n if (type !== 'undirected') {\n if (direction !== 'out') {\n found = forEachInObjectOnce(\n breakable,\n null,\n nodeData,\n nodeData.in,\n callback\n );\n\n if (breakable && found) return found;\n\n visited.wrap(nodeData.in);\n }\n if (direction !== 'in') {\n found = forEachInObjectOnce(\n breakable,\n visited,\n nodeData,\n nodeData.out,\n callback\n );\n\n if (breakable && found) return found;\n\n visited.wrap(nodeData.out);\n }\n }\n\n if (type !== 'directed') {\n found = forEachInObjectOnce(\n breakable,\n visited,\n nodeData,\n nodeData.undirected,\n callback\n );\n\n if (breakable && found) return found;\n }\n\n return;\n}\n\n/**\n * Function creating an array of relevant neighbors for the given node.\n *\n * @param {string} type - Type of neighbors.\n * @param {string} direction - Direction.\n * @param {any} nodeData - Target node's data.\n * @return {Array} - The list of neighbors.\n */\nfunction createNeighborArrayForNode(type, direction, nodeData) {\n // If we want only undirected or in or out, we can roll some optimizations\n if (type !== 'mixed') {\n if (type === 'undirected') return Object.keys(nodeData.undirected);\n\n if (typeof direction === 'string') return Object.keys(nodeData[direction]);\n }\n\n const neighbors = [];\n\n forEachNeighbor(false, type, direction, nodeData, function (key) {\n neighbors.push(key);\n });\n\n return neighbors;\n}\n\n/**\n * Function returning an iterator over the given node's relevant neighbors.\n *\n * @param {string} type - Type of neighbors.\n * @param {string} direction - Direction.\n * @param {any} nodeData - Target node's data.\n * @return {Iterator}\n */\nfunction createDedupedObjectIterator(visited, nodeData, object) {\n const keys = Object.keys(object);\n const l = keys.length;\n\n let i = 0;\n\n return {\n [Symbol.iterator]() {\n return this;\n },\n next() {\n let neighborData = null;\n\n do {\n if (i >= l) {\n if (visited) visited.wrap(object);\n return {done: true};\n }\n\n const edgeData = object[keys[i++]];\n\n const sourceData = edgeData.source;\n const targetData = edgeData.target;\n\n neighborData = sourceData === nodeData ? targetData : sourceData;\n\n if (visited && visited.has(neighborData.key)) {\n neighborData = null;\n continue;\n }\n } while (neighborData === null);\n\n return {\n done: false,\n value: {neighbor: neighborData.key, attributes: neighborData.attributes}\n };\n }\n };\n}\n\nfunction createNeighborIterator(type, direction, nodeData) {\n // If we want only undirected or in or out, we can roll some optimizations\n if (type !== 'mixed') {\n if (type === 'undirected')\n return createDedupedObjectIterator(null, nodeData, nodeData.undirected);\n\n if (typeof direction === 'string')\n return createDedupedObjectIterator(null, nodeData, nodeData[direction]);\n }\n\n let iterator = emptyIterator();\n\n // Else we need to keep a set of neighbors not to return duplicates\n // We cheat by querying the other adjacencies\n const visited = new CompositeSetWrapper();\n\n if (type !== 'undirected') {\n if (direction !== 'out') {\n iterator = chain(\n iterator,\n createDedupedObjectIterator(visited, nodeData, nodeData.in)\n );\n }\n if (direction !== 'in') {\n iterator = chain(\n iterator,\n createDedupedObjectIterator(visited, nodeData, nodeData.out)\n );\n }\n }\n\n if (type !== 'directed') {\n iterator = chain(\n iterator,\n createDedupedObjectIterator(visited, nodeData, nodeData.undirected)\n );\n }\n\n return iterator;\n}\n\n/**\n * Function attaching a neighbors array creator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachNeighborArrayCreator(Class, description) {\n const {name, type, direction} = description;\n\n /**\n * Function returning an array of certain neighbors.\n *\n * @param {any} node - Target node.\n * @return {array} - The neighbors of neighbors.\n *\n * @throws {Error} - Will throw if node is not found in the graph.\n */\n Class.prototype[name] = function (node) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return [];\n\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${node}\" node in the graph.`\n );\n\n // Here, we want to iterate over a node's relevant neighbors\n return createNeighborArrayForNode(\n type === 'mixed' ? this.type : type,\n direction,\n nodeData\n );\n };\n}\n\n/**\n * Function attaching a neighbors callback iterator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachForEachNeighbor(Class, description) {\n const {name, type, direction} = description;\n\n const forEachName = 'forEach' + name[0].toUpperCase() + name.slice(1, -1);\n\n /**\n * Function iterating over all the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[forEachName] = function (node, callback) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type) return;\n\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${forEachName}: could not find the \"${node}\" node in the graph.`\n );\n\n // Here, we want to iterate over a node's relevant neighbors\n forEachNeighbor(\n false,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData,\n callback\n );\n };\n\n /**\n * Function mapping the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const mapName = 'map' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[mapName] = function (node, callback) {\n // TODO: optimize when size is known beforehand\n const result = [];\n\n this[forEachName](node, (n, a) => {\n result.push(callback(n, a));\n });\n\n return result;\n };\n\n /**\n * Function filtering the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const filterName = 'filter' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[filterName] = function (node, callback) {\n const result = [];\n\n this[forEachName](node, (n, a) => {\n if (callback(n, a)) result.push(n);\n });\n\n return result;\n };\n\n /**\n * Function reducing the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const reduceName = 'reduce' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[reduceName] = function (node, callback, initialValue) {\n if (arguments.length < 3)\n throw new InvalidArgumentsGraphError(\n `Graph.${reduceName}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`\n );\n\n let accumulator = initialValue;\n\n this[forEachName](node, (n, a) => {\n accumulator = callback(accumulator, n, a);\n });\n\n return accumulator;\n };\n}\n\n/**\n * Function attaching a breakable neighbors callback iterator method to the\n * Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachFindNeighbor(Class, description) {\n const {name, type, direction} = description;\n\n const capitalizedSingular = name[0].toUpperCase() + name.slice(1, -1);\n\n const findName = 'find' + capitalizedSingular;\n\n /**\n * Function iterating over all the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[findName] = function (node, callback) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type) return;\n\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${findName}: could not find the \"${node}\" node in the graph.`\n );\n\n // Here, we want to iterate over a node's relevant neighbors\n return forEachNeighbor(\n true,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData,\n callback\n );\n };\n\n /**\n * Function iterating over all the relevant neighbors to find if any of them\n * matches the given predicate.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const someName = 'some' + capitalizedSingular;\n\n Class.prototype[someName] = function (node, callback) {\n const found = this[findName](node, callback);\n\n if (found) return true;\n\n return false;\n };\n\n /**\n * Function iterating over all the relevant neighbors to find if all of them\n * matche the given predicate.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const everyName = 'every' + capitalizedSingular;\n\n Class.prototype[everyName] = function (node, callback) {\n const found = this[findName](node, (n, a) => {\n return !callback(n, a);\n });\n\n if (found) return false;\n\n return true;\n };\n}\n\n/**\n * Function attaching a neighbors callback iterator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachNeighborIteratorCreator(Class, description) {\n const {name, type, direction} = description;\n\n const iteratorName = name.slice(0, -1) + 'Entries';\n\n /**\n * Function returning an iterator over all the relevant neighbors.\n *\n * @param {any} node - Target node.\n * @return {Iterator}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[iteratorName] = function (node) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return emptyIterator();\n\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${iteratorName}: could not find the \"${node}\" node in the graph.`\n );\n\n // Here, we want to iterate over a node's relevant neighbors\n return createNeighborIterator(\n type === 'mixed' ? this.type : type,\n direction,\n nodeData\n );\n };\n}\n\n/**\n * Function attaching every neighbor iteration method to the Graph class.\n *\n * @param {function} Graph - Graph class.\n */\nfunction attachNeighborIterationMethods(Graph) {\n NEIGHBORS_ITERATION.forEach(description => {\n attachNeighborArrayCreator(Graph, description);\n attachForEachNeighbor(Graph, description);\n attachFindNeighbor(Graph, description);\n attachNeighborIteratorCreator(Graph, description);\n });\n}\n\n/**\n * Graphology Adjacency Iteration\n * ===============================\n *\n * Attaching some methods to the Graph class to be able to iterate over a\n * graph's adjacency.\n */\n\n/**\n * Function iterating over a simple graph's adjacency using a callback.\n *\n * @param {boolean} breakable - Can we break?\n * @param {boolean} assymetric - Whether to emit undirected edges only once.\n * @param {boolean} disconnectedNodes - Whether to emit disconnected nodes.\n * @param {Graph} graph - Target Graph instance.\n * @param {callback} function - Iteration callback.\n */\nfunction forEachAdjacency(\n breakable,\n assymetric,\n disconnectedNodes,\n graph,\n callback\n) {\n const iterator = graph._nodes.values();\n\n const type = graph.type;\n\n let step, sourceData, neighbor, adj, edgeData, targetData, shouldBreak;\n\n while (((step = iterator.next()), step.done !== true)) {\n let hasEdges = false;\n\n sourceData = step.value;\n\n if (type !== 'undirected') {\n adj = sourceData.out;\n\n for (neighbor in adj) {\n edgeData = adj[neighbor];\n\n do {\n targetData = edgeData.target;\n\n hasEdges = true;\n shouldBreak = callback(\n sourceData.key,\n targetData.key,\n sourceData.attributes,\n targetData.attributes,\n edgeData.key,\n edgeData.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData;\n\n edgeData = edgeData.next;\n } while (edgeData);\n }\n }\n\n if (type !== 'directed') {\n adj = sourceData.undirected;\n\n for (neighbor in adj) {\n if (assymetric && sourceData.key > neighbor) continue;\n\n edgeData = adj[neighbor];\n\n do {\n targetData = edgeData.target;\n\n if (targetData.key !== neighbor) targetData = edgeData.source;\n\n hasEdges = true;\n shouldBreak = callback(\n sourceData.key,\n targetData.key,\n sourceData.attributes,\n targetData.attributes,\n edgeData.key,\n edgeData.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData;\n\n edgeData = edgeData.next;\n } while (edgeData);\n }\n }\n\n if (disconnectedNodes && !hasEdges) {\n shouldBreak = callback(\n sourceData.key,\n null,\n sourceData.attributes,\n null,\n null,\n null,\n null\n );\n\n if (breakable && shouldBreak) return null;\n }\n }\n\n return;\n}\n\n/**\n * Graphology Serialization Utilities\n * ===================================\n *\n * Collection of functions used by the graph serialization schemes.\n */\n\n/**\n * Formats internal node data into a serialized node.\n *\n * @param {any} key - The node's key.\n * @param {object} data - Internal node's data.\n * @return {array} - The serialized node.\n */\nfunction serializeNode(key, data) {\n const serialized = {key};\n\n if (!isEmpty(data.attributes))\n serialized.attributes = assign({}, data.attributes);\n\n return serialized;\n}\n\n/**\n * Formats internal edge data into a serialized edge.\n *\n * @param {string} type - The graph's type.\n * @param {any} key - The edge's key.\n * @param {object} data - Internal edge's data.\n * @return {array} - The serialized edge.\n */\nfunction serializeEdge(type, key, data) {\n const serialized = {\n key,\n source: data.source.key,\n target: data.target.key\n };\n\n if (!isEmpty(data.attributes))\n serialized.attributes = assign({}, data.attributes);\n\n if (type === 'mixed' && data.undirected) serialized.undirected = true;\n\n return serialized;\n}\n\n/**\n * Checks whether the given value is a serialized node.\n *\n * @param {mixed} value - Target value.\n * @return {string|null}\n */\nfunction validateSerializedNode(value) {\n if (!isPlainObject(value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid serialized node. A serialized node should be a plain object with at least a \"key\" property.'\n );\n\n if (!('key' in value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: serialized node is missing its key.'\n );\n\n if (\n 'attributes' in value &&\n (!isPlainObject(value.attributes) || value.attributes === null)\n )\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.'\n );\n}\n\n/**\n * Checks whether the given value is a serialized edge.\n *\n * @param {mixed} value - Target value.\n * @return {string|null}\n */\nfunction validateSerializedEdge(value) {\n if (!isPlainObject(value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a \"source\" & \"target\" property.'\n );\n\n if (!('source' in value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: serialized edge is missing its source.'\n );\n\n if (!('target' in value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: serialized edge is missing its target.'\n );\n\n if (\n 'attributes' in value &&\n (!isPlainObject(value.attributes) || value.attributes === null)\n )\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.'\n );\n\n if ('undirected' in value && typeof value.undirected !== 'boolean')\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.'\n );\n}\n\n/* eslint no-nested-ternary: 0 */\n\n/**\n * Constants.\n */\nconst INSTANCE_ID = incrementalIdStartingFromRandomByte();\n\n/**\n * Enums.\n */\nconst TYPES = new Set(['directed', 'undirected', 'mixed']);\n\nconst EMITTER_PROPS = new Set([\n 'domain',\n '_events',\n '_eventsCount',\n '_maxListeners'\n]);\n\nconst EDGE_ADD_METHODS = [\n {\n name: verb => `${verb}Edge`,\n generateKey: true\n },\n {\n name: verb => `${verb}DirectedEdge`,\n generateKey: true,\n type: 'directed'\n },\n {\n name: verb => `${verb}UndirectedEdge`,\n generateKey: true,\n type: 'undirected'\n },\n {\n name: verb => `${verb}EdgeWithKey`\n },\n {\n name: verb => `${verb}DirectedEdgeWithKey`,\n type: 'directed'\n },\n {\n name: verb => `${verb}UndirectedEdgeWithKey`,\n type: 'undirected'\n }\n];\n\n/**\n * Default options.\n */\nconst DEFAULTS = {\n allowSelfLoops: true,\n multi: false,\n type: 'mixed'\n};\n\n/**\n * Abstract functions used by the Graph class for various methods.\n */\n\n/**\n * Internal method used to add a node to the given graph\n *\n * @param {Graph} graph - Target graph.\n * @param {any} node - The node's key.\n * @param {object} [attributes] - Optional attributes.\n * @return {NodeData} - Created node data.\n */\nfunction addNode(graph, node, attributes) {\n if (attributes && !isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.addNode: invalid attributes. Expecting an object but got \"${attributes}\"`\n );\n\n // String coercion\n node = '' + node;\n attributes = attributes || {};\n\n if (graph._nodes.has(node))\n throw new UsageGraphError(\n `Graph.addNode: the \"${node}\" node already exist in the graph.`\n );\n\n const data = new graph.NodeDataClass(node, attributes);\n\n // Adding the node to internal register\n graph._nodes.set(node, data);\n\n // Emitting\n graph.emit('nodeAdded', {\n key: node,\n attributes\n });\n\n return data;\n}\n\n/**\n * Same as the above but without sanity checks because we call this in contexts\n * where necessary checks were already done.\n */\nfunction unsafeAddNode(graph, node, attributes) {\n const data = new graph.NodeDataClass(node, attributes);\n\n graph._nodes.set(node, data);\n\n graph.emit('nodeAdded', {\n key: node,\n attributes\n });\n\n return data;\n}\n\n/**\n * Internal method used to add an arbitrary edge to the given graph.\n *\n * @param {Graph} graph - Target graph.\n * @param {string} name - Name of the child method for errors.\n * @param {boolean} mustGenerateKey - Should the graph generate an id?\n * @param {boolean} undirected - Whether the edge is undirected.\n * @param {any} edge - The edge's key.\n * @param {any} source - The source node.\n * @param {any} target - The target node.\n * @param {object} [attributes] - Optional attributes.\n * @return {any} - The edge.\n *\n * @throws {Error} - Will throw if the graph is of the wrong type.\n * @throws {Error} - Will throw if the given attributes are not an object.\n * @throws {Error} - Will throw if source or target doesn't exist.\n * @throws {Error} - Will throw if the edge already exist.\n */\nfunction addEdge(\n graph,\n name,\n mustGenerateKey,\n undirected,\n edge,\n source,\n target,\n attributes\n) {\n // Checking validity of operation\n if (!undirected && graph.type === 'undirected')\n throw new UsageGraphError(\n `Graph.${name}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`\n );\n\n if (undirected && graph.type === 'directed')\n throw new UsageGraphError(\n `Graph.${name}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`\n );\n\n if (attributes && !isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: invalid attributes. Expecting an object but got \"${attributes}\"`\n );\n\n // Coercion of source & target:\n source = '' + source;\n target = '' + target;\n attributes = attributes || {};\n\n if (!graph.allowSelfLoops && source === target)\n throw new UsageGraphError(\n `Graph.${name}: source & target are the same (\"${source}\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`\n );\n\n const sourceData = graph._nodes.get(source),\n targetData = graph._nodes.get(target);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${name}: source node \"${source}\" not found.`\n );\n\n if (!targetData)\n throw new NotFoundGraphError(\n `Graph.${name}: target node \"${target}\" not found.`\n );\n\n // Must the graph generate an id for this edge?\n const eventData = {\n key: null,\n undirected,\n source,\n target,\n attributes\n };\n\n if (mustGenerateKey) {\n // NOTE: in this case we can guarantee that the key does not already\n // exist and is already correctly casted as a string\n edge = graph._edgeKeyGenerator();\n } else {\n // Coercion of edge key\n edge = '' + edge;\n\n // Here, we have a key collision\n if (graph._edges.has(edge))\n throw new UsageGraphError(\n `Graph.${name}: the \"${edge}\" edge already exists in the graph.`\n );\n }\n\n // Here, we might have a source / target collision\n if (\n !graph.multi &&\n (undirected\n ? typeof sourceData.undirected[target] !== 'undefined'\n : typeof sourceData.out[target] !== 'undefined')\n ) {\n throw new UsageGraphError(\n `Graph.${name}: an edge linking \"${source}\" to \"${target}\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`\n );\n }\n\n // Storing some data\n const edgeData = new EdgeData(\n undirected,\n edge,\n sourceData,\n targetData,\n attributes\n );\n\n // Adding the edge to the internal register\n graph._edges.set(edge, edgeData);\n\n // Incrementing node degree counters\n const isSelfLoop = source === target;\n\n if (undirected) {\n sourceData.undirectedDegree++;\n targetData.undirectedDegree++;\n\n if (isSelfLoop) {\n sourceData.undirectedLoops++;\n graph._undirectedSelfLoopCount++;\n }\n } else {\n sourceData.outDegree++;\n targetData.inDegree++;\n\n if (isSelfLoop) {\n sourceData.directedLoops++;\n graph._directedSelfLoopCount++;\n }\n }\n\n // Updating relevant index\n if (graph.multi) edgeData.attachMulti();\n else edgeData.attach();\n\n if (undirected) graph._undirectedSize++;\n else graph._directedSize++;\n\n // Emitting\n eventData.key = edge;\n\n graph.emit('edgeAdded', eventData);\n\n return edge;\n}\n\n/**\n * Internal method used to add an arbitrary edge to the given graph.\n *\n * @param {Graph} graph - Target graph.\n * @param {string} name - Name of the child method for errors.\n * @param {boolean} mustGenerateKey - Should the graph generate an id?\n * @param {boolean} undirected - Whether the edge is undirected.\n * @param {any} edge - The edge's key.\n * @param {any} source - The source node.\n * @param {any} target - The target node.\n * @param {object} [attributes] - Optional attributes.\n * @param {boolean} [asUpdater] - Are we updating or merging?\n * @return {any} - The edge.\n *\n * @throws {Error} - Will throw if the graph is of the wrong type.\n * @throws {Error} - Will throw if the given attributes are not an object.\n * @throws {Error} - Will throw if source or target doesn't exist.\n * @throws {Error} - Will throw if the edge already exist.\n */\nfunction mergeEdge(\n graph,\n name,\n mustGenerateKey,\n undirected,\n edge,\n source,\n target,\n attributes,\n asUpdater\n) {\n // Checking validity of operation\n if (!undirected && graph.type === 'undirected')\n throw new UsageGraphError(\n `Graph.${name}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`\n );\n\n if (undirected && graph.type === 'directed')\n throw new UsageGraphError(\n `Graph.${name}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`\n );\n\n if (attributes) {\n if (asUpdater) {\n if (typeof attributes !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: invalid updater function. Expecting a function but got \"${attributes}\"`\n );\n } else {\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: invalid attributes. Expecting an object but got \"${attributes}\"`\n );\n }\n }\n\n // Coercion of source & target:\n source = '' + source;\n target = '' + target;\n\n let updater;\n\n if (asUpdater) {\n updater = attributes;\n attributes = undefined;\n }\n\n if (!graph.allowSelfLoops && source === target)\n throw new UsageGraphError(\n `Graph.${name}: source & target are the same (\"${source}\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`\n );\n\n let sourceData = graph._nodes.get(source);\n let targetData = graph._nodes.get(target);\n let edgeData;\n\n // Do we need to handle duplicate?\n let alreadyExistingEdgeData;\n\n if (!mustGenerateKey) {\n edgeData = graph._edges.get(edge);\n\n if (edgeData) {\n // Here, we need to ensure, if the user gave a key, that source & target\n // are consistent\n if (edgeData.source.key !== source || edgeData.target.key !== target) {\n // If source or target inconsistent\n if (\n !undirected ||\n edgeData.source.key !== target ||\n edgeData.target.key !== source\n ) {\n // If directed, or source/target aren't flipped\n throw new UsageGraphError(\n `Graph.${name}: inconsistency detected when attempting to merge the \"${edge}\" edge with \"${source}\" source & \"${target}\" target vs. (\"${edgeData.source.key}\", \"${edgeData.target.key}\").`\n );\n }\n }\n\n alreadyExistingEdgeData = edgeData;\n }\n }\n\n // Here, we might have a source / target collision\n if (!alreadyExistingEdgeData && !graph.multi && sourceData) {\n alreadyExistingEdgeData = undirected\n ? sourceData.undirected[target]\n : sourceData.out[target];\n }\n\n // Handling duplicates\n if (alreadyExistingEdgeData) {\n const info = [alreadyExistingEdgeData.key, false, false, false];\n\n // We can skip the attribute merging part if the user did not provide them\n if (asUpdater ? !updater : !attributes) return info;\n\n // Updating the attributes\n if (asUpdater) {\n const oldAttributes = alreadyExistingEdgeData.attributes;\n alreadyExistingEdgeData.attributes = updater(oldAttributes);\n\n graph.emit('edgeAttributesUpdated', {\n type: 'replace',\n key: alreadyExistingEdgeData.key,\n attributes: alreadyExistingEdgeData.attributes\n });\n }\n\n // Merging the attributes\n else {\n assign(alreadyExistingEdgeData.attributes, attributes);\n\n graph.emit('edgeAttributesUpdated', {\n type: 'merge',\n key: alreadyExistingEdgeData.key,\n attributes: alreadyExistingEdgeData.attributes,\n data: attributes\n });\n }\n\n return info;\n }\n\n attributes = attributes || {};\n\n if (asUpdater && updater) attributes = updater(attributes);\n\n // Must the graph generate an id for this edge?\n const eventData = {\n key: null,\n undirected,\n source,\n target,\n attributes\n };\n\n if (mustGenerateKey) {\n // NOTE: in this case we can guarantee that the key does not already\n // exist and is already correctly casted as a string\n edge = graph._edgeKeyGenerator();\n } else {\n // Coercion of edge key\n edge = '' + edge;\n\n // Here, we have a key collision\n if (graph._edges.has(edge))\n throw new UsageGraphError(\n `Graph.${name}: the \"${edge}\" edge already exists in the graph.`\n );\n }\n\n let sourceWasAdded = false;\n let targetWasAdded = false;\n\n if (!sourceData) {\n sourceData = unsafeAddNode(graph, source, {});\n sourceWasAdded = true;\n\n if (source === target) {\n targetData = sourceData;\n targetWasAdded = true;\n }\n }\n if (!targetData) {\n targetData = unsafeAddNode(graph, target, {});\n targetWasAdded = true;\n }\n\n // Storing some data\n edgeData = new EdgeData(undirected, edge, sourceData, targetData, attributes);\n\n // Adding the edge to the internal register\n graph._edges.set(edge, edgeData);\n\n // Incrementing node degree counters\n const isSelfLoop = source === target;\n\n if (undirected) {\n sourceData.undirectedDegree++;\n targetData.undirectedDegree++;\n\n if (isSelfLoop) {\n sourceData.undirectedLoops++;\n graph._undirectedSelfLoopCount++;\n }\n } else {\n sourceData.outDegree++;\n targetData.inDegree++;\n\n if (isSelfLoop) {\n sourceData.directedLoops++;\n graph._directedSelfLoopCount++;\n }\n }\n\n // Updating relevant index\n if (graph.multi) edgeData.attachMulti();\n else edgeData.attach();\n\n if (undirected) graph._undirectedSize++;\n else graph._directedSize++;\n\n // Emitting\n eventData.key = edge;\n\n graph.emit('edgeAdded', eventData);\n\n return [edge, true, sourceWasAdded, targetWasAdded];\n}\n\n/**\n * Internal method used to drop an edge.\n *\n * @param {Graph} graph - Target graph.\n * @param {EdgeData} edgeData - Data of the edge to drop.\n */\nfunction dropEdgeFromData(graph, edgeData) {\n // Dropping the edge from the register\n graph._edges.delete(edgeData.key);\n\n // Updating related degrees\n const {source: sourceData, target: targetData, attributes} = edgeData;\n\n const undirected = edgeData.undirected;\n\n const isSelfLoop = sourceData === targetData;\n\n if (undirected) {\n sourceData.undirectedDegree--;\n targetData.undirectedDegree--;\n\n if (isSelfLoop) {\n sourceData.undirectedLoops--;\n graph._undirectedSelfLoopCount--;\n }\n } else {\n sourceData.outDegree--;\n targetData.inDegree--;\n\n if (isSelfLoop) {\n sourceData.directedLoops--;\n graph._directedSelfLoopCount--;\n }\n }\n\n // Clearing index\n if (graph.multi) edgeData.detachMulti();\n else edgeData.detach();\n\n if (undirected) graph._undirectedSize--;\n else graph._directedSize--;\n\n // Emitting\n graph.emit('edgeDropped', {\n key: edgeData.key,\n attributes,\n source: sourceData.key,\n target: targetData.key,\n undirected\n });\n}\n\n/**\n * Graph class\n *\n * @constructor\n * @param {object} [options] - Options:\n * @param {boolean} [allowSelfLoops] - Allow self loops?\n * @param {string} [type] - Type of the graph.\n * @param {boolean} [map] - Allow references as keys?\n * @param {boolean} [multi] - Allow parallel edges?\n *\n * @throws {Error} - Will throw if the arguments are not valid.\n */\nclass Graph extends EventEmitter {\n constructor(options) {\n super();\n\n //-- Solving options\n options = assign({}, DEFAULTS, options);\n\n // Enforcing options validity\n if (typeof options.multi !== 'boolean')\n throw new InvalidArgumentsGraphError(\n `Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"${options.multi}\".`\n );\n\n if (!TYPES.has(options.type))\n throw new InvalidArgumentsGraphError(\n `Graph.constructor: invalid 'type' option. Should be one of \"mixed\", \"directed\" or \"undirected\" but got \"${options.type}\".`\n );\n\n if (typeof options.allowSelfLoops !== 'boolean')\n throw new InvalidArgumentsGraphError(\n `Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"${options.allowSelfLoops}\".`\n );\n\n //-- Private properties\n\n // Utilities\n const NodeDataClass =\n options.type === 'mixed'\n ? MixedNodeData\n : options.type === 'directed'\n ? DirectedNodeData\n : UndirectedNodeData;\n\n privateProperty(this, 'NodeDataClass', NodeDataClass);\n\n // Internal edge key generator\n\n // NOTE: this internal generator produce keys that are strings\n // composed of a weird prefix, an incremental instance id starting from\n // a random byte and finally an internal instance incremental id.\n // All this to avoid intra-frame and cross-frame adversarial inputs\n // that can force a single #.addEdge call to degenerate into a O(n)\n // available key search loop.\n\n // It also ensures that automatically generated edge keys are unlikely\n // to produce collisions with arbitrary keys given by users.\n const instancePrefix = 'geid_' + INSTANCE_ID() + '_';\n let edgeId = 0;\n\n const edgeKeyGenerator = () => {\n let availableEdgeKey;\n\n do {\n availableEdgeKey = instancePrefix + edgeId++;\n } while (this._edges.has(availableEdgeKey));\n\n return availableEdgeKey;\n };\n\n // Indexes\n privateProperty(this, '_attributes', {});\n privateProperty(this, '_nodes', new Map());\n privateProperty(this, '_edges', new Map());\n privateProperty(this, '_directedSize', 0);\n privateProperty(this, '_undirectedSize', 0);\n privateProperty(this, '_directedSelfLoopCount', 0);\n privateProperty(this, '_undirectedSelfLoopCount', 0);\n privateProperty(this, '_edgeKeyGenerator', edgeKeyGenerator);\n\n // Options\n privateProperty(this, '_options', options);\n\n // Emitter properties\n EMITTER_PROPS.forEach(prop => privateProperty(this, prop, this[prop]));\n\n //-- Properties readers\n readOnlyProperty(this, 'order', () => this._nodes.size);\n readOnlyProperty(this, 'size', () => this._edges.size);\n readOnlyProperty(this, 'directedSize', () => this._directedSize);\n readOnlyProperty(this, 'undirectedSize', () => this._undirectedSize);\n readOnlyProperty(\n this,\n 'selfLoopCount',\n () => this._directedSelfLoopCount + this._undirectedSelfLoopCount\n );\n readOnlyProperty(\n this,\n 'directedSelfLoopCount',\n () => this._directedSelfLoopCount\n );\n readOnlyProperty(\n this,\n 'undirectedSelfLoopCount',\n () => this._undirectedSelfLoopCount\n );\n readOnlyProperty(this, 'multi', this._options.multi);\n readOnlyProperty(this, 'type', this._options.type);\n readOnlyProperty(this, 'allowSelfLoops', this._options.allowSelfLoops);\n readOnlyProperty(this, 'implementation', () => 'graphology');\n }\n\n _resetInstanceCounters() {\n this._directedSize = 0;\n this._undirectedSize = 0;\n this._directedSelfLoopCount = 0;\n this._undirectedSelfLoopCount = 0;\n }\n\n /**---------------------------------------------------------------------------\n * Read\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method returning whether the given node is found in the graph.\n *\n * @param {any} node - The node.\n * @return {boolean}\n */\n hasNode(node) {\n return this._nodes.has('' + node);\n }\n\n /**\n * Method returning whether the given directed edge is found in the graph.\n *\n * Arity 1:\n * @param {any} edge - The edge's key.\n *\n * Arity 2:\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the arguments are invalid.\n */\n hasDirectedEdge(source, target) {\n // Early termination\n if (this.type === 'undirected') return false;\n\n if (arguments.length === 1) {\n const edge = '' + source;\n\n const edgeData = this._edges.get(edge);\n\n return !!edgeData && !edgeData.undirected;\n } else if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n // If the node source or the target is not in the graph we break\n const nodeData = this._nodes.get(source);\n\n if (!nodeData) return false;\n\n // Is there a directed edge pointing toward target?\n return nodeData.out.hasOwnProperty(target);\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`\n );\n }\n\n /**\n * Method returning whether the given undirected edge is found in the graph.\n *\n * Arity 1:\n * @param {any} edge - The edge's key.\n *\n * Arity 2:\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the arguments are invalid.\n */\n hasUndirectedEdge(source, target) {\n // Early termination\n if (this.type === 'directed') return false;\n\n if (arguments.length === 1) {\n const edge = '' + source;\n\n const edgeData = this._edges.get(edge);\n\n return !!edgeData && edgeData.undirected;\n } else if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n // If the node source or the target is not in the graph we break\n const nodeData = this._nodes.get(source);\n\n if (!nodeData) return false;\n\n // Is there a directed edge pointing toward target?\n return nodeData.undirected.hasOwnProperty(target);\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`\n );\n }\n\n /**\n * Method returning whether the given edge is found in the graph.\n *\n * Arity 1:\n * @param {any} edge - The edge's key.\n *\n * Arity 2:\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the arguments are invalid.\n */\n hasEdge(source, target) {\n if (arguments.length === 1) {\n const edge = '' + source;\n\n return this._edges.has(edge);\n } else if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n // If the node source or the target is not in the graph we break\n const nodeData = this._nodes.get(source);\n\n if (!nodeData) return false;\n\n // Is there a directed edge pointing toward target?\n return (\n (typeof nodeData.out !== 'undefined' &&\n nodeData.out.hasOwnProperty(target)) ||\n (typeof nodeData.undirected !== 'undefined' &&\n nodeData.undirected.hasOwnProperty(target))\n );\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`\n );\n }\n\n /**\n * Method returning the edge matching source & target in a directed fashion.\n *\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {any|undefined}\n *\n * @throws {Error} - Will throw if the graph is multi.\n * @throws {Error} - Will throw if source or target doesn't exist.\n */\n directedEdge(source, target) {\n if (this.type === 'undirected') return;\n\n source = '' + source;\n target = '' + target;\n\n if (this.multi)\n throw new UsageGraphError(\n 'Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.'\n );\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.directedEdge: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.directedEdge: could not find the \"${target}\" target node in the graph.`\n );\n\n const edgeData = (sourceData.out && sourceData.out[target]) || undefined;\n\n if (edgeData) return edgeData.key;\n }\n\n /**\n * Method returning the edge matching source & target in a undirected fashion.\n *\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {any|undefined}\n *\n * @throws {Error} - Will throw if the graph is multi.\n * @throws {Error} - Will throw if source or target doesn't exist.\n */\n undirectedEdge(source, target) {\n if (this.type === 'directed') return;\n\n source = '' + source;\n target = '' + target;\n\n if (this.multi)\n throw new UsageGraphError(\n 'Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.'\n );\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.undirectedEdge: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.undirectedEdge: could not find the \"${target}\" target node in the graph.`\n );\n\n const edgeData =\n (sourceData.undirected && sourceData.undirected[target]) || undefined;\n\n if (edgeData) return edgeData.key;\n }\n\n /**\n * Method returning the edge matching source & target in a mixed fashion.\n *\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {any|undefined}\n *\n * @throws {Error} - Will throw if the graph is multi.\n * @throws {Error} - Will throw if source or target doesn't exist.\n */\n edge(source, target) {\n if (this.multi)\n throw new UsageGraphError(\n 'Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.'\n );\n\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.edge: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.edge: could not find the \"${target}\" target node in the graph.`\n );\n\n const edgeData =\n (sourceData.out && sourceData.out[target]) ||\n (sourceData.undirected && sourceData.undirected[target]) ||\n undefined;\n\n if (edgeData) return edgeData.key;\n }\n\n /**\n * Method returning whether two nodes are directed neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areDirectedNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areDirectedNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return false;\n\n return neighbor in nodeData.in || neighbor in nodeData.out;\n }\n\n /**\n * Method returning whether two nodes are out neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areOutNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areOutNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return false;\n\n return neighbor in nodeData.out;\n }\n\n /**\n * Method returning whether two nodes are in neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areInNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areInNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return false;\n\n return neighbor in nodeData.in;\n }\n\n /**\n * Method returning whether two nodes are undirected neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areUndirectedNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areUndirectedNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'directed') return false;\n\n return neighbor in nodeData.undirected;\n }\n\n /**\n * Method returning whether two nodes are neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type !== 'undirected') {\n if (neighbor in nodeData.in || neighbor in nodeData.out) return true;\n }\n\n if (this.type !== 'directed') {\n if (neighbor in nodeData.undirected) return true;\n }\n\n return false;\n }\n\n /**\n * Method returning whether two nodes are inbound neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areInboundNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areInboundNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type !== 'undirected') {\n if (neighbor in nodeData.in) return true;\n }\n\n if (this.type !== 'directed') {\n if (neighbor in nodeData.undirected) return true;\n }\n\n return false;\n }\n\n /**\n * Method returning whether two nodes are outbound neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areOutboundNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areOutboundNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type !== 'undirected') {\n if (neighbor in nodeData.out) return true;\n }\n\n if (this.type !== 'directed') {\n if (neighbor in nodeData.undirected) return true;\n }\n\n return false;\n }\n\n /**\n * Method returning the given node's in degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n inDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.inDegree: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.inDegree;\n }\n\n /**\n * Method returning the given node's out degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n outDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.outDegree: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.outDegree;\n }\n\n /**\n * Method returning the given node's directed degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n directedDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.directedDegree: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.inDegree + nodeData.outDegree;\n }\n\n /**\n * Method returning the given node's undirected degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n undirectedDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.undirectedDegree: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'directed') return 0;\n\n return nodeData.undirectedDegree;\n }\n\n /**\n * Method returning the given node's inbound degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's inbound degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n inboundDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.inboundDegree: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.inDegree;\n }\n\n return degree;\n }\n\n /**\n * Method returning the given node's outbound degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's outbound degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n outboundDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.outboundDegree: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.outDegree;\n }\n\n return degree;\n }\n\n /**\n * Method returning the given node's directed degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n degree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.degree: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.inDegree + nodeData.outDegree;\n }\n\n return degree;\n }\n\n /**\n * Method returning the given node's in degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n inDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.inDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.inDegree - nodeData.directedLoops;\n }\n\n /**\n * Method returning the given node's out degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n outDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.outDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.outDegree - nodeData.directedLoops;\n }\n\n /**\n * Method returning the given node's directed degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n directedDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.directedDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.inDegree + nodeData.outDegree - nodeData.directedLoops * 2;\n }\n\n /**\n * Method returning the given node's undirected degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n undirectedDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.undirectedDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'directed') return 0;\n\n return nodeData.undirectedDegree - nodeData.undirectedLoops * 2;\n }\n\n /**\n * Method returning the given node's inbound degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's inbound degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n inboundDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.inboundDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n let loops = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n loops += nodeData.undirectedLoops * 2;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.inDegree;\n loops += nodeData.directedLoops;\n }\n\n return degree - loops;\n }\n\n /**\n * Method returning the given node's outbound degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's outbound degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n outboundDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.outboundDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n let loops = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n loops += nodeData.undirectedLoops * 2;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.outDegree;\n loops += nodeData.directedLoops;\n }\n\n return degree - loops;\n }\n\n /**\n * Method returning the given node's directed degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n degreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.degreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n let loops = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n loops += nodeData.undirectedLoops * 2;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.inDegree + nodeData.outDegree;\n loops += nodeData.directedLoops * 2;\n }\n\n return degree - loops;\n }\n\n /**\n * Method returning the given edge's source.\n *\n * @param {any} edge - The edge's key.\n * @return {any} - The edge's source.\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n source(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.source: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.source.key;\n }\n\n /**\n * Method returning the given edge's target.\n *\n * @param {any} edge - The edge's key.\n * @return {any} - The edge's target.\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n target(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.target: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.target.key;\n }\n\n /**\n * Method returning the given edge's extremities.\n *\n * @param {any} edge - The edge's key.\n * @return {array} - The edge's extremities.\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n extremities(edge) {\n edge = '' + edge;\n\n const edgeData = this._edges.get(edge);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.extremities: could not find the \"${edge}\" edge in the graph.`\n );\n\n return [edgeData.source.key, edgeData.target.key];\n }\n\n /**\n * Given a node & an edge, returns the other extremity of the edge.\n *\n * @param {any} node - The node's key.\n * @param {any} edge - The edge's key.\n * @return {any} - The related node.\n *\n * @throws {Error} - Will throw if the edge isn't in the graph or if the\n * edge & node are not related.\n */\n opposite(node, edge) {\n node = '' + node;\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.opposite: could not find the \"${edge}\" edge in the graph.`\n );\n\n const source = data.source.key;\n const target = data.target.key;\n\n if (node === source) return target;\n if (node === target) return source;\n\n throw new NotFoundGraphError(\n `Graph.opposite: the \"${node}\" node is not attached to the \"${edge}\" edge (${source}, ${target}).`\n );\n }\n\n /**\n * Returns whether the given edge has the given node as extremity.\n *\n * @param {any} edge - The edge's key.\n * @param {any} node - The node's key.\n * @return {boolean} - The related node.\n *\n * @throws {Error} - Will throw if either the node or the edge isn't in the graph.\n */\n hasExtremity(edge, node) {\n edge = '' + edge;\n node = '' + node;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.hasExtremity: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.source.key === node || data.target.key === node;\n }\n\n /**\n * Method returning whether the given edge is undirected.\n *\n * @param {any} edge - The edge's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n isUndirected(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.isUndirected: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.undirected;\n }\n\n /**\n * Method returning whether the given edge is directed.\n *\n * @param {any} edge - The edge's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n isDirected(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.isDirected: could not find the \"${edge}\" edge in the graph.`\n );\n\n return !data.undirected;\n }\n\n /**\n * Method returning whether the given edge is a self loop.\n *\n * @param {any} edge - The edge's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n isSelfLoop(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.isSelfLoop: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.source === data.target;\n }\n\n /**---------------------------------------------------------------------------\n * Mutation\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method used to add a node to the graph.\n *\n * @param {any} node - The node.\n * @param {object} [attributes] - Optional attributes.\n * @return {any} - The node.\n *\n * @throws {Error} - Will throw if the given node already exist.\n * @throws {Error} - Will throw if the given attributes are not an object.\n */\n addNode(node, attributes) {\n const nodeData = addNode(this, node, attributes);\n\n return nodeData.key;\n }\n\n /**\n * Method used to merge a node into the graph.\n *\n * @param {any} node - The node.\n * @param {object} [attributes] - Optional attributes.\n * @return {any} - The node.\n */\n mergeNode(node, attributes) {\n if (attributes && !isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.mergeNode: invalid attributes. Expecting an object but got \"${attributes}\"`\n );\n\n // String coercion\n node = '' + node;\n attributes = attributes || {};\n\n // If the node already exists, we merge the attributes\n let data = this._nodes.get(node);\n\n if (data) {\n if (attributes) {\n assign(data.attributes, attributes);\n\n this.emit('nodeAttributesUpdated', {\n type: 'merge',\n key: node,\n attributes: data.attributes,\n data: attributes\n });\n }\n return [node, false];\n }\n\n data = new this.NodeDataClass(node, attributes);\n\n // Adding the node to internal register\n this._nodes.set(node, data);\n\n // Emitting\n this.emit('nodeAdded', {\n key: node,\n attributes\n });\n\n return [node, true];\n }\n\n /**\n * Method used to add a node if it does not exist in the graph or else to\n * update its attributes using a function.\n *\n * @param {any} node - The node.\n * @param {function} [updater] - Optional updater function.\n * @return {any} - The node.\n */\n updateNode(node, updater) {\n if (updater && typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.updateNode: invalid updater function. Expecting a function but got \"${updater}\"`\n );\n\n // String coercion\n node = '' + node;\n\n // If the node already exists, we update the attributes\n let data = this._nodes.get(node);\n\n if (data) {\n if (updater) {\n const oldAttributes = data.attributes;\n data.attributes = updater(oldAttributes);\n\n this.emit('nodeAttributesUpdated', {\n type: 'replace',\n key: node,\n attributes: data.attributes\n });\n }\n return [node, false];\n }\n\n const attributes = updater ? updater({}) : {};\n\n data = new this.NodeDataClass(node, attributes);\n\n // Adding the node to internal register\n this._nodes.set(node, data);\n\n // Emitting\n this.emit('nodeAdded', {\n key: node,\n attributes\n });\n\n return [node, true];\n }\n\n /**\n * Method used to drop a single node & all its attached edges from the graph.\n *\n * @param {any} node - The node.\n * @return {Graph}\n *\n * @throws {Error} - Will throw if the node doesn't exist.\n */\n dropNode(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.dropNode: could not find the \"${node}\" node in the graph.`\n );\n\n let edgeData;\n\n // Removing attached edges\n // NOTE: we could be faster here, but this is such a pain to maintain\n if (this.type !== 'undirected') {\n for (const neighbor in nodeData.out) {\n edgeData = nodeData.out[neighbor];\n\n do {\n dropEdgeFromData(this, edgeData);\n edgeData = edgeData.next;\n } while (edgeData);\n }\n\n for (const neighbor in nodeData.in) {\n edgeData = nodeData.in[neighbor];\n\n do {\n dropEdgeFromData(this, edgeData);\n edgeData = edgeData.next;\n } while (edgeData);\n }\n }\n\n if (this.type !== 'directed') {\n for (const neighbor in nodeData.undirected) {\n edgeData = nodeData.undirected[neighbor];\n\n do {\n dropEdgeFromData(this, edgeData);\n edgeData = edgeData.next;\n } while (edgeData);\n }\n }\n\n // Dropping the node from the register\n this._nodes.delete(node);\n\n // Emitting\n this.emit('nodeDropped', {\n key: node,\n attributes: nodeData.attributes\n });\n }\n\n /**\n * Method used to drop a single edge from the graph.\n *\n * Arity 1:\n * @param {any} edge - The edge.\n *\n * Arity 2:\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {Graph}\n *\n * @throws {Error} - Will throw if the edge doesn't exist.\n */\n dropEdge(edge) {\n let edgeData;\n\n if (arguments.length > 1) {\n const source = '' + arguments[0];\n const target = '' + arguments[1];\n\n edgeData = getMatchingEdge(this, source, target, this.type);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.dropEdge: could not find the \"${source}\" -> \"${target}\" edge in the graph.`\n );\n } else {\n edge = '' + edge;\n\n edgeData = this._edges.get(edge);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.dropEdge: could not find the \"${edge}\" edge in the graph.`\n );\n }\n\n dropEdgeFromData(this, edgeData);\n\n return this;\n }\n\n /**\n * Method used to drop a single directed edge from the graph.\n *\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {Graph}\n *\n * @throws {Error} - Will throw if the edge doesn't exist.\n */\n dropDirectedEdge(source, target) {\n if (arguments.length < 2)\n throw new UsageGraphError(\n 'Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.'\n );\n\n if (this.multi)\n throw new UsageGraphError(\n 'Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.'\n );\n\n source = '' + source;\n target = '' + target;\n\n const edgeData = getMatchingEdge(this, source, target, 'directed');\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.dropDirectedEdge: could not find a \"${source}\" -> \"${target}\" edge in the graph.`\n );\n\n dropEdgeFromData(this, edgeData);\n\n return this;\n }\n\n /**\n * Method used to drop a single undirected edge from the graph.\n *\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {Graph}\n *\n * @throws {Error} - Will throw if the edge doesn't exist.\n */\n dropUndirectedEdge(source, target) {\n if (arguments.length < 2)\n throw new UsageGraphError(\n 'Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.'\n );\n\n if (this.multi)\n throw new UsageGraphError(\n 'Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.'\n );\n\n const edgeData = getMatchingEdge(this, source, target, 'undirected');\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.dropUndirectedEdge: could not find a \"${source}\" -> \"${target}\" edge in the graph.`\n );\n\n dropEdgeFromData(this, edgeData);\n\n return this;\n }\n\n /**\n * Method used to remove every edge & every node from the graph.\n *\n * @return {Graph}\n */\n clear() {\n // Clearing edges\n this._edges.clear();\n\n // Clearing nodes\n this._nodes.clear();\n\n // Reset counters\n this._resetInstanceCounters();\n\n // Emitting\n this.emit('cleared');\n }\n\n /**\n * Method used to remove every edge from the graph.\n *\n * @return {Graph}\n */\n clearEdges() {\n // Clearing structure index\n const iterator = this._nodes.values();\n\n let step;\n\n while (((step = iterator.next()), step.done !== true)) {\n step.value.clear();\n }\n\n // Clearing edges\n this._edges.clear();\n\n // Reset counters\n this._resetInstanceCounters();\n\n // Emitting\n this.emit('edgesCleared');\n }\n\n /**---------------------------------------------------------------------------\n * Attributes-related methods\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method returning the desired graph's attribute.\n *\n * @param {string} name - Name of the attribute.\n * @return {any}\n */\n getAttribute(name) {\n return this._attributes[name];\n }\n\n /**\n * Method returning the graph's attributes.\n *\n * @return {object}\n */\n getAttributes() {\n return this._attributes;\n }\n\n /**\n * Method returning whether the graph has the desired attribute.\n *\n * @param {string} name - Name of the attribute.\n * @return {boolean}\n */\n hasAttribute(name) {\n return this._attributes.hasOwnProperty(name);\n }\n\n /**\n * Method setting a value for the desired graph's attribute.\n *\n * @param {string} name - Name of the attribute.\n * @param {any} value - Value for the attribute.\n * @return {Graph}\n */\n setAttribute(name, value) {\n this._attributes[name] = value;\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'set',\n attributes: this._attributes,\n name\n });\n\n return this;\n }\n\n /**\n * Method using a function to update the desired graph's attribute's value.\n *\n * @param {string} name - Name of the attribute.\n * @param {function} updater - Function use to update the attribute's value.\n * @return {Graph}\n */\n updateAttribute(name, updater) {\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.updateAttribute: updater should be a function.'\n );\n\n const value = this._attributes[name];\n\n this._attributes[name] = updater(value);\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'set',\n attributes: this._attributes,\n name\n });\n\n return this;\n }\n\n /**\n * Method removing the desired graph's attribute.\n *\n * @param {string} name - Name of the attribute.\n * @return {Graph}\n */\n removeAttribute(name) {\n delete this._attributes[name];\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'remove',\n attributes: this._attributes,\n name\n });\n\n return this;\n }\n\n /**\n * Method replacing the graph's attributes.\n *\n * @param {object} attributes - New attributes.\n * @return {Graph}\n *\n * @throws {Error} - Will throw if given attributes are not a plain object.\n */\n replaceAttributes(attributes) {\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n 'Graph.replaceAttributes: provided attributes are not a plain object.'\n );\n\n this._attributes = attributes;\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'replace',\n attributes: this._attributes\n });\n\n return this;\n }\n\n /**\n * Method merging the graph's attributes.\n *\n * @param {object} attributes - Attributes to merge.\n * @return {Graph}\n *\n * @throws {Error} - Will throw if given attributes are not a plain object.\n */\n mergeAttributes(attributes) {\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n 'Graph.mergeAttributes: provided attributes are not a plain object.'\n );\n\n assign(this._attributes, attributes);\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'merge',\n attributes: this._attributes,\n data: attributes\n });\n\n return this;\n }\n\n /**\n * Method updating the graph's attributes.\n *\n * @param {function} updater - Function used to update the attributes.\n * @return {Graph}\n *\n * @throws {Error} - Will throw if given updater is not a function.\n */\n updateAttributes(updater) {\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.updateAttributes: provided updater is not a function.'\n );\n\n this._attributes = updater(this._attributes);\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'update',\n attributes: this._attributes\n });\n\n return this;\n }\n\n /**\n * Method used to update each node's attributes using the given function.\n *\n * @param {function} updater - Updater function to use.\n * @param {object} [hints] - Optional hints.\n */\n updateEachNodeAttributes(updater, hints) {\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.updateEachNodeAttributes: expecting an updater function.'\n );\n\n if (hints && !validateHints(hints))\n throw new InvalidArgumentsGraphError(\n 'Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n nodeData.attributes = updater(nodeData.key, nodeData.attributes);\n }\n\n this.emit('eachNodeAttributesUpdated', {\n hints: hints ? hints : null\n });\n }\n\n /**\n * Method used to update each edge's attributes using the given function.\n *\n * @param {function} updater - Updater function to use.\n * @param {object} [hints] - Optional hints.\n */\n updateEachEdgeAttributes(updater, hints) {\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.updateEachEdgeAttributes: expecting an updater function.'\n );\n\n if (hints && !validateHints(hints))\n throw new InvalidArgumentsGraphError(\n 'Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}'\n );\n\n const iterator = this._edges.values();\n\n let step, edgeData, sourceData, targetData;\n\n while (((step = iterator.next()), step.done !== true)) {\n edgeData = step.value;\n sourceData = edgeData.source;\n targetData = edgeData.target;\n\n edgeData.attributes = updater(\n edgeData.key,\n edgeData.attributes,\n sourceData.key,\n targetData.key,\n sourceData.attributes,\n targetData.attributes,\n edgeData.undirected\n );\n }\n\n this.emit('eachEdgeAttributesUpdated', {\n hints: hints ? hints : null\n });\n }\n\n /**---------------------------------------------------------------------------\n * Iteration-related methods\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method iterating over the graph's adjacency using the given callback.\n *\n * @param {function} callback - Callback to use.\n */\n forEachAdjacencyEntry(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachAdjacencyEntry: expecting a callback.'\n );\n\n forEachAdjacency(false, false, false, this, callback);\n }\n forEachAdjacencyEntryWithOrphans(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.'\n );\n\n forEachAdjacency(false, false, true, this, callback);\n }\n\n /**\n * Method iterating over the graph's assymetric adjacency using the given callback.\n *\n * @param {function} callback - Callback to use.\n */\n forEachAssymetricAdjacencyEntry(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachAssymetricAdjacencyEntry: expecting a callback.'\n );\n\n forEachAdjacency(false, true, false, this, callback);\n }\n forEachAssymetricAdjacencyEntryWithOrphans(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.'\n );\n\n forEachAdjacency(false, true, true, this, callback);\n }\n\n /**\n * Method returning the list of the graph's nodes.\n *\n * @return {array} - The nodes.\n */\n nodes() {\n return Array.from(this._nodes.keys());\n }\n\n /**\n * Method iterating over the graph's nodes using the given callback.\n *\n * @param {function} callback - Callback (key, attributes, index).\n */\n forEachNode(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n callback(nodeData.key, nodeData.attributes);\n }\n }\n\n /**\n * Method iterating attempting to find a node matching the given predicate\n * function.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n findNode(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.findNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n\n if (callback(nodeData.key, nodeData.attributes)) return nodeData.key;\n }\n\n return;\n }\n\n /**\n * Method mapping nodes.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n mapNodes(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.mapNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n const result = new Array(this.order);\n let i = 0;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n result[i++] = callback(nodeData.key, nodeData.attributes);\n }\n\n return result;\n }\n\n /**\n * Method returning whether some node verify the given predicate.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n someNode(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.someNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n\n if (callback(nodeData.key, nodeData.attributes)) return true;\n }\n\n return false;\n }\n\n /**\n * Method returning whether all node verify the given predicate.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n everyNode(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.everyNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n\n if (!callback(nodeData.key, nodeData.attributes)) return false;\n }\n\n return true;\n }\n\n /**\n * Method filtering nodes.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n filterNodes(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.filterNodes: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n const result = [];\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n\n if (callback(nodeData.key, nodeData.attributes))\n result.push(nodeData.key);\n }\n\n return result;\n }\n\n /**\n * Method reducing nodes.\n *\n * @param {function} callback - Callback (accumulator, key, attributes).\n */\n reduceNodes(callback, initialValue) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.reduceNodes: expecting a callback.'\n );\n\n if (arguments.length < 2)\n throw new InvalidArgumentsGraphError(\n 'Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.'\n );\n\n let accumulator = initialValue;\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n accumulator = callback(accumulator, nodeData.key, nodeData.attributes);\n }\n\n return accumulator;\n }\n\n /**\n * Method returning an iterator over the graph's node entries.\n *\n * @return {Iterator}\n */\n nodeEntries() {\n const iterator = this._nodes.values();\n\n return {\n [Symbol.iterator]() {\n return this;\n },\n next() {\n const step = iterator.next();\n if (step.done) return step;\n const data = step.value;\n return {\n value: {node: data.key, attributes: data.attributes},\n done: false\n };\n }\n };\n }\n\n /**---------------------------------------------------------------------------\n * Serialization\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method used to export the whole graph.\n *\n * @return {object} - The serialized graph.\n */\n export() {\n const nodes = new Array(this._nodes.size);\n\n let i = 0;\n\n this._nodes.forEach((data, key) => {\n nodes[i++] = serializeNode(key, data);\n });\n\n const edges = new Array(this._edges.size);\n\n i = 0;\n\n this._edges.forEach((data, key) => {\n edges[i++] = serializeEdge(this.type, key, data);\n });\n\n return {\n options: {\n type: this.type,\n multi: this.multi,\n allowSelfLoops: this.allowSelfLoops\n },\n attributes: this.getAttributes(),\n nodes,\n edges\n };\n }\n\n /**\n * Method used to import a serialized graph.\n *\n * @param {object|Graph} data - The serialized graph.\n * @param {boolean} merge - Whether to merge data.\n * @return {Graph} - Returns itself for chaining.\n */\n import(data, merge = false) {\n // Importing a Graph instance directly\n if (data instanceof Graph) {\n // Nodes\n data.forEachNode((n, a) => {\n if (merge) this.mergeNode(n, a);\n else this.addNode(n, a);\n });\n\n // Edges\n data.forEachEdge((e, a, s, t, _sa, _ta, u) => {\n if (merge) {\n if (u) this.mergeUndirectedEdgeWithKey(e, s, t, a);\n else this.mergeDirectedEdgeWithKey(e, s, t, a);\n } else {\n if (u) this.addUndirectedEdgeWithKey(e, s, t, a);\n else this.addDirectedEdgeWithKey(e, s, t, a);\n }\n });\n\n return this;\n }\n\n // Importing a serialized graph\n if (!isPlainObject(data))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.'\n );\n\n if (data.attributes) {\n if (!isPlainObject(data.attributes))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid attributes. Expecting a plain object.'\n );\n\n if (merge) this.mergeAttributes(data.attributes);\n else this.replaceAttributes(data.attributes);\n }\n\n let i, l, list, node, edge;\n\n if (data.nodes) {\n list = data.nodes;\n\n if (!Array.isArray(list))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid nodes. Expecting an array.'\n );\n\n for (i = 0, l = list.length; i < l; i++) {\n node = list[i];\n\n // Validating\n validateSerializedNode(node);\n\n // Adding the node\n const {key, attributes} = node;\n\n if (merge) this.mergeNode(key, attributes);\n else this.addNode(key, attributes);\n }\n }\n\n if (data.edges) {\n let undirectedByDefault = false;\n\n if (this.type === 'undirected') {\n undirectedByDefault = true;\n }\n\n list = data.edges;\n\n if (!Array.isArray(list))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid edges. Expecting an array.'\n );\n\n for (i = 0, l = list.length; i < l; i++) {\n edge = list[i];\n\n // Validating\n validateSerializedEdge(edge);\n\n // Adding the edge\n const {\n source,\n target,\n attributes,\n undirected = undirectedByDefault\n } = edge;\n\n let method;\n\n if ('key' in edge) {\n method = merge\n ? undirected\n ? this.mergeUndirectedEdgeWithKey\n : this.mergeDirectedEdgeWithKey\n : undirected\n ? this.addUndirectedEdgeWithKey\n : this.addDirectedEdgeWithKey;\n\n method.call(this, edge.key, source, target, attributes);\n } else {\n method = merge\n ? undirected\n ? this.mergeUndirectedEdge\n : this.mergeDirectedEdge\n : undirected\n ? this.addUndirectedEdge\n : this.addDirectedEdge;\n\n method.call(this, source, target, attributes);\n }\n }\n }\n\n return this;\n }\n\n /**---------------------------------------------------------------------------\n * Utils\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method returning a null copy of the graph, i.e. a graph without nodes\n * & edges but with the exact same options.\n *\n * @param {object} options - Options to merge with the current ones.\n * @return {Graph} - The null copy.\n */\n nullCopy(options) {\n const graph = new Graph(assign({}, this._options, options));\n graph.replaceAttributes(assign({}, this.getAttributes()));\n return graph;\n }\n\n /**\n * Method returning an empty copy of the graph, i.e. a graph without edges but\n * with the exact same options.\n *\n * @param {object} options - Options to merge with the current ones.\n * @return {Graph} - The empty copy.\n */\n emptyCopy(options) {\n const graph = this.nullCopy(options);\n\n this._nodes.forEach((nodeData, key) => {\n const attributes = assign({}, nodeData.attributes);\n\n // NOTE: no need to emit events since user cannot access the instance yet\n nodeData = new graph.NodeDataClass(key, attributes);\n graph._nodes.set(key, nodeData);\n });\n\n return graph;\n }\n\n /**\n * Method returning an exact copy of the graph.\n *\n * @param {object} options - Upgrade options.\n * @return {Graph} - The copy.\n */\n copy(options) {\n options = options || {};\n\n if (\n typeof options.type === 'string' &&\n options.type !== this.type &&\n options.type !== 'mixed'\n )\n throw new UsageGraphError(\n `Graph.copy: cannot create an incompatible copy from \"${this.type}\" type to \"${options.type}\" because this would mean losing information about the current graph.`\n );\n\n if (\n typeof options.multi === 'boolean' &&\n options.multi !== this.multi &&\n options.multi !== true\n )\n throw new UsageGraphError(\n 'Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.'\n );\n\n if (\n typeof options.allowSelfLoops === 'boolean' &&\n options.allowSelfLoops !== this.allowSelfLoops &&\n options.allowSelfLoops !== true\n )\n throw new UsageGraphError(\n 'Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.'\n );\n\n const graph = this.emptyCopy(options);\n\n const iterator = this._edges.values();\n\n let step, edgeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n edgeData = step.value;\n\n // NOTE: no need to emit events since user cannot access the instance yet\n addEdge(\n graph,\n 'copy',\n false,\n edgeData.undirected,\n edgeData.key,\n edgeData.source.key,\n edgeData.target.key,\n assign({}, edgeData.attributes)\n );\n }\n\n return graph;\n }\n\n /**---------------------------------------------------------------------------\n * Known methods\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method used by JavaScript to perform JSON serialization.\n *\n * @return {object} - The serialized graph.\n */\n toJSON() {\n return this.export();\n }\n\n /**\n * Method returning [object Graph].\n */\n toString() {\n return '[object Graph]';\n }\n\n /**\n * Method used internally by node's console to display a custom object.\n *\n * @return {object} - Formatted object representation of the graph.\n */\n inspect() {\n const nodes = {};\n this._nodes.forEach((data, key) => {\n nodes[key] = data.attributes;\n });\n\n const edges = {},\n multiIndex = {};\n\n this._edges.forEach((data, key) => {\n const direction = data.undirected ? '--' : '->';\n\n let label = '';\n\n let source = data.source.key;\n let target = data.target.key;\n let tmp;\n\n if (data.undirected && source > target) {\n tmp = source;\n source = target;\n target = tmp;\n }\n\n const desc = `(${source})${direction}(${target})`;\n\n if (!key.startsWith('geid_')) {\n label += `[${key}]: `;\n } else if (this.multi) {\n if (typeof multiIndex[desc] === 'undefined') {\n multiIndex[desc] = 0;\n } else {\n multiIndex[desc]++;\n }\n\n label += `${multiIndex[desc]}. `;\n }\n\n label += desc;\n\n edges[label] = data.attributes;\n });\n\n const dummy = {};\n\n for (const k in this) {\n if (\n this.hasOwnProperty(k) &&\n !EMITTER_PROPS.has(k) &&\n typeof this[k] !== 'function' &&\n typeof k !== 'symbol'\n )\n dummy[k] = this[k];\n }\n\n dummy.attributes = this._attributes;\n dummy.nodes = nodes;\n dummy.edges = edges;\n\n privateProperty(dummy, 'constructor', this.constructor);\n\n return dummy;\n }\n}\n\n/**\n * Attaching methods to the prototype.\n *\n * Here, we are attaching a wide variety of methods to the Graph class'\n * prototype when those are very numerous and when their creation is\n * abstracted.\n */\n\n/**\n * Attaching custom inspect method for node >= 10.\n */\nif (typeof Symbol !== 'undefined')\n Graph.prototype[Symbol.for('nodejs.util.inspect.custom')] =\n Graph.prototype.inspect;\n\n/**\n * Related to edge addition.\n */\nEDGE_ADD_METHODS.forEach(method => {\n ['add', 'merge', 'update'].forEach(verb => {\n const name = method.name(verb);\n const fn = verb === 'add' ? addEdge : mergeEdge;\n\n if (method.generateKey) {\n Graph.prototype[name] = function (source, target, attributes) {\n return fn(\n this,\n name,\n true,\n (method.type || this.type) === 'undirected',\n null,\n source,\n target,\n attributes,\n verb === 'update'\n );\n };\n } else {\n Graph.prototype[name] = function (edge, source, target, attributes) {\n return fn(\n this,\n name,\n false,\n (method.type || this.type) === 'undirected',\n edge,\n source,\n target,\n attributes,\n verb === 'update'\n );\n };\n }\n });\n});\n\n/**\n * Attributes-related.\n */\nattachNodeAttributesMethods(Graph);\nattachEdgeAttributesMethods(Graph);\n\n/**\n * Edge iteration-related.\n */\nattachEdgeIterationMethods(Graph);\n\n/**\n * Neighbor iteration-related.\n */\nattachNeighborIterationMethods(Graph);\n\n/**\n * Graphology Helper Classes\n * ==========================\n *\n * Building some higher-order classes instantiating the graph with\n * predefinite options.\n */\n\n/**\n * Alternative constructors.\n */\nclass DirectedGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({type: 'directed'}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== false)\n throw new InvalidArgumentsGraphError(\n 'DirectedGraph.from: inconsistent indication that the graph should be multi in given options!'\n );\n\n if (finalOptions.type !== 'directed')\n throw new InvalidArgumentsGraphError(\n 'DirectedGraph.from: inconsistent \"' +\n finalOptions.type +\n '\" type in given options!'\n );\n\n super(finalOptions);\n }\n}\nclass UndirectedGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({type: 'undirected'}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== false)\n throw new InvalidArgumentsGraphError(\n 'UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!'\n );\n\n if (finalOptions.type !== 'undirected')\n throw new InvalidArgumentsGraphError(\n 'UndirectedGraph.from: inconsistent \"' +\n finalOptions.type +\n '\" type in given options!'\n );\n\n super(finalOptions);\n }\n}\nclass MultiGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({multi: true}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== true)\n throw new InvalidArgumentsGraphError(\n 'MultiGraph.from: inconsistent indication that the graph should be simple in given options!'\n );\n\n super(finalOptions);\n }\n}\nclass MultiDirectedGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({type: 'directed', multi: true}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== true)\n throw new InvalidArgumentsGraphError(\n 'MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!'\n );\n\n if (finalOptions.type !== 'directed')\n throw new InvalidArgumentsGraphError(\n 'MultiDirectedGraph.from: inconsistent \"' +\n finalOptions.type +\n '\" type in given options!'\n );\n\n super(finalOptions);\n }\n}\nclass MultiUndirectedGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({type: 'undirected', multi: true}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== true)\n throw new InvalidArgumentsGraphError(\n 'MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!'\n );\n\n if (finalOptions.type !== 'undirected')\n throw new InvalidArgumentsGraphError(\n 'MultiUndirectedGraph.from: inconsistent \"' +\n finalOptions.type +\n '\" type in given options!'\n );\n\n super(finalOptions);\n }\n}\n\n/**\n * Attaching static #.from method to each of the constructors.\n */\nfunction attachStaticFromMethod(Class) {\n /**\n * Builds a graph from serialized data or another graph's data.\n *\n * @param {Graph|SerializedGraph} data - Hydratation data.\n * @param {object} [options] - Options.\n * @return {Class}\n */\n Class.from = function (data, options) {\n // Merging given options with serialized ones\n const finalOptions = assign({}, data.options, options);\n\n const instance = new Class(finalOptions);\n instance.import(data);\n\n return instance;\n };\n}\n\nattachStaticFromMethod(Graph);\nattachStaticFromMethod(DirectedGraph);\nattachStaticFromMethod(UndirectedGraph);\nattachStaticFromMethod(MultiGraph);\nattachStaticFromMethod(MultiDirectedGraph);\nattachStaticFromMethod(MultiUndirectedGraph);\n\nGraph.Graph = Graph;\nGraph.DirectedGraph = DirectedGraph;\nGraph.UndirectedGraph = UndirectedGraph;\nGraph.MultiGraph = MultiGraph;\nGraph.MultiDirectedGraph = MultiDirectedGraph;\nGraph.MultiUndirectedGraph = MultiUndirectedGraph;\n\nGraph.InvalidArgumentsGraphError = InvalidArgumentsGraphError;\nGraph.NotFoundGraphError = NotFoundGraphError;\nGraph.UsageGraphError = UsageGraphError;\n\n/**\n * Graphology ESM Endoint\n * =======================\n *\n * Endpoint for ESM modules consumers.\n */\n\nexport { DirectedGraph, Graph, InvalidArgumentsGraphError, MultiDirectedGraph, MultiGraph, MultiUndirectedGraph, NotFoundGraphError, UndirectedGraph, UsageGraphError, Graph as default };\n//# sourceMappingURL=graphology.mjs.map\n","/**\n * Graphology isGraph\n * ===================\n *\n * Very simple function aiming at ensuring the given variable is a\n * graphology instance.\n */\n\n/**\n * Checking the value is a graphology instance.\n *\n * @param {any} value - Target value.\n * @return {boolean}\n */\nmodule.exports = function isGraph(value) {\n return (\n value !== null &&\n typeof value === 'object' &&\n typeof value.addUndirectedEdgeWithKey === 'function' &&\n typeof value.dropNode === 'function' &&\n typeof value.multi === 'boolean'\n );\n};\n","/*\n * Copyright 2026 OpenTrace Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Deterministic color assignment for node types.\n * Ported from insight-ui's getGroupColor — uses a fixed palette\n * with DJB2 hash fallback for unknown types.\n */\n\nconst PALETTE = [\n '#6366f1', // Indigo\n '#f59e0b', // Amber\n '#10b981', // Emerald\n '#8b5cf6', // Violet\n '#ef4444', // Red\n '#3b82f6', // Blue\n '#ec4899', // Pink\n '#14b8a6', // Teal\n '#f97316', // Orange\n '#84cc16', // Lime\n '#a855f7', // Purple\n '#06b6d4', // Cyan\n];\n\n/** Well-known node types → fixed colors for visual consistency */\nconst KNOWN: Record<string, string> = {\n Repository: '#10b981',\n Class: '#3b82f6',\n Function: '#a855f7',\n File: '#84cc16',\n Directory: '#22d3ee',\n};\n\nfunction djb2(str: string): number {\n let h = 5381;\n for (let i = 0; i < str.length; i++) {\n h = ((h << 5) + h + str.charCodeAt(i)) | 0;\n }\n return Math.abs(h);\n}\n\nexport function getNodeColor(type: string): string {\n return KNOWN[type] ?? PALETTE[djb2(type) % PALETTE.length];\n}\n","/*\n * Copyright 2026 OpenTrace Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Deterministic color assignment for relationship (link) types.\n * Follows the same pattern as nodeColors.ts — fixed palette with\n * DJB2 hash fallback for unknown types.\n */\n\nconst PALETTE = [\n '#f472b6', // Pink\n '#60a5fa', // Blue\n '#34d399', // Emerald\n '#fbbf24', // Amber\n '#a78bfa', // Violet\n '#fb923c', // Orange\n '#2dd4bf', // Teal\n '#f87171', // Red\n '#38bdf8', // Sky\n '#a3e635', // Lime\n '#c084fc', // Purple\n '#22d3ee', // Cyan\n];\n\n/** Well-known relationship types → fixed colors */\nconst KNOWN: Record<string, string> = {\n CALLS: '#60a5fa', // Blue — invocation / dependency chains\n READS: '#fbbf24', // Amber — data access\n WRITES: '#fb923c', // Orange — data mutation\n DEFINED_IN: '#34d399', // Emerald — containment / location\n PART_OF: '#2dd4bf', // Teal — structural membership\n DEPENDS_ON: '#f472b6', // Pink — dependency edges\n EXTENDS: '#a78bfa', // Violet — inheritance\n HANDLES: '#38bdf8', // Sky — endpoint handling\n IMPORTS: '#c084fc', // Purple — module imports\n AUTHORED: '#f87171', // Red — authorship\n ASSIGNED: '#22d3ee', // Cyan — assignment\n PARTICIPATED: '#a3e635', // Lime — participation\n};\n\nfunction djb2(str: string): number {\n let h = 5381;\n for (let i = 0; i < str.length; i++) {\n h = ((h << 5) + h + str.charCodeAt(i)) | 0;\n }\n return Math.abs(h);\n}\n\nexport function getLinkColor(type: string): string {\n const upper = type.toUpperCase();\n return KNOWN[upper] ?? PALETTE[djb2(upper) % PALETTE.length];\n}\n","/*\n * Copyright 2026 OpenTrace Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Community detection color palette and mapping utilities.\n * Separate from the type palette in nodeColors.ts to avoid confusion when toggling.\n * Uses warm/cool alternation for maximum perceptual distance on dark backgrounds.\n */\n\nconst COMMUNITY_PALETTE = [\n '#f472b6', // Pink\n '#38bdf8', // Sky\n '#fb923c', // Orange\n '#4ade80', // Green\n '#c084fc', // Purple\n '#fbbf24', // Amber\n '#22d3ee', // Cyan\n '#f87171', // Red\n '#a3e635', // Lime\n '#818cf8', // Indigo\n '#fb7185', // Rose\n '#2dd4bf', // Teal\n '#e879f9', // Fuchsia\n '#60a5fa', // Blue\n '#facc15', // Yellow\n '#34d399', // Emerald\n];\n\nconst FALLBACK_COLOR = '#64748b'; // Slate grey\n\n/**\n * Build a stable community→color mapping, sorted by member count (largest community\n * gets the first palette slot). This ensures the most prominent communities get the\n * most visually distinct colors.\n */\nexport function buildCommunityColorMap(\n assignments: Record<string, number>,\n): Map<number, string> {\n // Count members per community\n const counts = new Map<number, number>();\n for (const communityId of Object.values(assignments)) {\n counts.set(communityId, (counts.get(communityId) || 0) + 1);\n }\n\n // Sort by count descending\n const sorted = [...counts.entries()].sort((a, b) => b[1] - a[1]);\n\n const colorMap = new Map<number, string>();\n for (let i = 0; i < sorted.length; i++) {\n colorMap.set(sorted[i][0], COMMUNITY_PALETTE[i % COMMUNITY_PALETTE.length]);\n }\n return colorMap;\n}\n\n// Node types that represent structural containers (ordered by priority — most specific first)\nconst CONTAINER_TYPES = ['Package', 'Directory', 'Repository'];\n\ninterface NameableNode {\n id: string;\n name: string;\n type: string;\n}\n\n/**\n * Derive a human-readable name for each community based on its member nodes.\n *\n * Strategy (in priority order):\n * 1. Highest-priority container node (Module > Package > Directory > ...)\n * 2. Longest common path prefix of node names (e.g., \"src/components\")\n * 3. Hub node — the node whose name appears most often as a prefix/substring\n * in other members' names, or failing that, the shortest-named node\n * (often the defining class/file of the cluster)\n * 4. Dominant node type + hub qualifier (e.g., \"Functions · handleRequest\")\n *\n * A final dedup pass appends the hub node name to any colliding labels.\n */\nexport function buildCommunityNames(\n assignments: Record<string, number>,\n nodes: NameableNode[],\n): Map<number, string> {\n // Group nodes by community\n const groups = new Map<number, NameableNode[]>();\n for (const node of nodes) {\n const cid = assignments[node.id];\n if (cid === undefined) continue;\n let list = groups.get(cid);\n if (!list) {\n list = [];\n groups.set(cid, list);\n }\n list.push(node);\n }\n\n const names = new Map<number, string>();\n // Track hub node per community for dedup\n const hubs = new Map<number, string>();\n\n for (const [cid, members] of groups) {\n const hub = findHubNode(members);\n if (hub) hubs.set(cid, hub);\n\n // Strategy 1: Find the highest-priority container node\n let containerName: string | null = null;\n let bestPriority = CONTAINER_TYPES.length;\n for (const node of members) {\n const priority = CONTAINER_TYPES.indexOf(node.type);\n if (priority !== -1 && priority < bestPriority) {\n bestPriority = priority;\n containerName = node.name;\n }\n }\n if (containerName) {\n names.set(cid, containerName);\n continue;\n }\n\n // Strategy 2: Longest common path prefix\n const nodeNames = members.map((n) => n.name);\n const prefix = longestCommonPrefix(nodeNames);\n if (prefix.length > 0) {\n // Trim to last path separator for a clean directory-like name\n const trimmed = prefix.includes('/')\n ? prefix.slice(0, prefix.lastIndexOf('/') + 1)\n : prefix.includes('.')\n ? prefix.slice(0, prefix.lastIndexOf('.') + 1)\n : prefix;\n if (trimmed.length > 1) {\n names.set(cid, trimmed.replace(/\\/$/, ''));\n continue;\n }\n }\n\n // Strategy 3: Hub node name directly (if it's distinctive enough)\n if (hub) {\n names.set(cid, hub);\n continue;\n }\n\n // Strategy 4: Dominant node type (last resort)\n const typeCounts = new Map<string, number>();\n for (const node of members) {\n typeCounts.set(node.type, (typeCounts.get(node.type) || 0) + 1);\n }\n let dominantType = 'Nodes';\n let maxCount = 0;\n for (const [type, count] of typeCounts) {\n if (count > maxCount) {\n maxCount = count;\n dominantType = type;\n }\n }\n names.set(cid, pluralize(dominantType));\n }\n\n // Dedup: guarantee every community name is unique.\n // Pass 1: append hub qualifier to collisions.\n // Pass 2: if still colliding, append numeric suffix.\n dedup(names, hubs);\n\n return names;\n}\n\n/**\n * Find the most representative node in a community.\n * Picks the node whose name is a prefix/substring of the most other members,\n * breaking ties by shortest name (classes/files tend to be shorter than methods).\n */\nfunction findHubNode(members: NameableNode[]): string | null {\n if (members.length === 0) return null;\n if (members.length === 1) return members[0].name;\n\n // Score each node by how many other members' names contain it as substring\n const scores: { name: string; score: number; len: number }[] = [];\n for (const node of members) {\n const lowerName = node.name.toLowerCase();\n // Skip very short names (single char, empty) — they'd match everything\n if (lowerName.length <= 1) continue;\n let score = 0;\n for (const other of members) {\n if (other === node) continue;\n if (other.name.toLowerCase().includes(lowerName)) score++;\n }\n scores.push({ name: node.name, score, len: node.name.length });\n }\n\n if (scores.length === 0) {\n // All names are very short — pick the shortest\n return members.reduce((a, b) => (a.name.length <= b.name.length ? a : b))\n .name;\n }\n\n // Sort by: highest score, then shortest name\n scores.sort((a, b) => b.score - a.score || a.len - b.len);\n\n return scores[0].name;\n}\n\n/** Mutates `names` until every value is unique. */\nfunction dedup(names: Map<number, string>, hubs: Map<number, string>): void {\n // Collect collisions\n const byCid = () => {\n const map = new Map<string, number[]>();\n for (const [cid, name] of names) {\n let list = map.get(name);\n if (!list) {\n list = [];\n map.set(name, list);\n }\n list.push(cid);\n }\n return map;\n };\n\n // Pass 1: append hub qualifier\n for (const [, cids] of byCid()) {\n if (cids.length <= 1) continue;\n for (const cid of cids) {\n const hub = hubs.get(cid);\n const current = names.get(cid)!;\n if (hub && hub !== current && !current.includes(hub)) {\n names.set(cid, `${current} · ${hub}`);\n }\n }\n }\n\n // Pass 2: if still colliding, append numeric suffix\n for (const [, cids] of byCid()) {\n if (cids.length <= 1) continue;\n for (let i = 0; i < cids.length; i++) {\n const cid = cids[i];\n names.set(cid, `${names.get(cid)!} (${i + 1})`);\n }\n }\n}\n\nfunction longestCommonPrefix(strings: string[]): string {\n if (strings.length === 0) return '';\n if (strings.length === 1) return strings[0];\n let prefix = strings[0];\n for (let i = 1; i < strings.length; i++) {\n while (!strings[i].startsWith(prefix)) {\n prefix = prefix.slice(0, -1);\n if (prefix.length === 0) return '';\n }\n }\n return prefix;\n}\n\nfunction pluralize(type: string): string {\n if (type.endsWith('s')) return type;\n if (type.endsWith('y')) return type.slice(0, -1) + 'ies';\n return type + 's';\n}\n\n/**\n * Look up the community color for a given node.\n */\nexport function getCommunityColor(\n communityAssignments: Record<string, number>,\n communityColorMap: Map<number, string>,\n nodeId: string,\n): string {\n const communityId = communityAssignments[nodeId];\n if (communityId === undefined) return FALLBACK_COLOR;\n return communityColorMap.get(communityId) ?? FALLBACK_COLOR;\n}\n","/*\n * Copyright 2026 OpenTrace Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect } from 'react';\nimport type Graph from 'graphology';\nimport type { GraphNode, FilterState, GetSubTypeFn } from './types';\n\n// ─── Filter Logic ───────────────────────────────────────────────────────\n\n/**\n * Determine whether a node should be hidden based on the current filter state.\n * Exported so it can be reused by other components.\n */\nexport function shouldHideNode(\n node: GraphNode,\n filterState: FilterState,\n communityAssignments: Record<string, number>,\n availableSubTypes: Map<string, { subType: string; count: number }[]>,\n getSubType: GetSubTypeFn,\n): boolean {\n // Community filter\n const communityId = communityAssignments[node.id];\n if (\n communityId !== undefined &&\n filterState.hiddenCommunities.has(communityId)\n ) {\n return true;\n }\n\n // Sub-type filter: only applies when the node type has sub-types\n const subTypes = availableSubTypes.get(node.type);\n if (subTypes && subTypes.length > 0) {\n const subType = getSubType(node);\n if (subType && filterState.hiddenSubTypes.has(`${node.type}:${subType}`)) {\n return true;\n }\n }\n\n // Type filter\n if (filterState.hiddenNodeTypes.has(node.type)) {\n return true;\n }\n\n return false;\n}\n\n// ─── Hook ───────────────────────────────────────────────────────────────\n\n/**\n * Sets `hidden` attribute on nodes/edges based on filter state.\n * Never touches x/y positions.\n */\nexport function useGraphFilters(\n graph: Graph,\n layoutReady: boolean,\n filterState: FilterState,\n communityAssignments: Record<string, number>,\n availableSubTypes: Map<string, { subType: string; count: number }[]>,\n getSubType: GetSubTypeFn,\n): void {\n useEffect(() => {\n if (!layoutReady || graph.order === 0) return;\n\n // Track which nodes are hidden so we can hide their edges too\n const hiddenNodes = new Set<string>();\n\n // Batched node update — single event\n graph.updateEachNodeAttributes((id, attrs) => {\n const graphNode = attrs._graphNode as GraphNode | undefined;\n if (!graphNode) return attrs;\n\n const hidden = shouldHideNode(\n graphNode,\n filterState,\n communityAssignments,\n availableSubTypes,\n getSubType,\n );\n\n if (hidden) hiddenNodes.add(id);\n attrs.hidden = hidden;\n return attrs;\n });\n\n // Batched edge update — single event\n graph.updateEachEdgeAttributes((_id, attrs, source, target) => {\n // Hide edge if either endpoint is hidden\n if (hiddenNodes.has(source) || hiddenNodes.has(target)) {\n attrs.hidden = true;\n return attrs;\n }\n\n // Hide edge if its link type is hidden\n const label = attrs.label as string | undefined;\n if (label && filterState.hiddenLinkTypes.has(label)) {\n attrs.hidden = true;\n return attrs;\n }\n\n attrs.hidden = false;\n return attrs;\n });\n }, [\n graph,\n layoutReady,\n filterState,\n communityAssignments,\n availableSubTypes,\n getSubType,\n ]);\n}\n","/**\n * Graphology Defaults\n * ====================\n *\n * Helper function used throughout the standard lib to resolve defaults.\n */\nfunction isLeaf(o) {\n return (\n !o ||\n typeof o !== 'object' ||\n typeof o === 'function' ||\n Array.isArray(o) ||\n o instanceof Set ||\n o instanceof Map ||\n o instanceof RegExp ||\n o instanceof Date\n );\n}\n\nfunction resolveDefaults(target, defaults) {\n target = target || {};\n\n var output = {};\n\n for (var k in defaults) {\n var existing = target[k];\n var def = defaults[k];\n\n // Recursion\n if (!isLeaf(def)) {\n output[k] = resolveDefaults(existing, def);\n\n continue;\n }\n\n // Leaf\n if (existing === undefined) {\n output[k] = def;\n } else {\n output[k] = existing;\n }\n }\n\n return output;\n}\n\nmodule.exports = resolveDefaults;\n","/**\n * Graphology inferType\n * =====================\n *\n * Useful function used to \"guess\" the real type of the given Graph using\n * introspection.\n */\nvar isGraph = require('./is-graph.js');\n\n/**\n * Returning the inferred type of the given graph.\n *\n * @param {Graph} graph - Target graph.\n * @return {boolean}\n */\nmodule.exports = function inferType(graph) {\n if (!isGraph(graph))\n throw new Error(\n 'graphology-utils/infer-type: expecting a valid graphology instance.'\n );\n\n var declaredType = graph.type;\n\n if (declaredType !== 'mixed') return declaredType;\n\n if (\n (graph.directedSize === 0 && graph.undirectedSize === 0) ||\n (graph.directedSize > 0 && graph.undirectedSize > 0)\n )\n return 'mixed';\n\n if (graph.directedSize > 0) return 'directed';\n\n return 'undirected';\n};\n","/**\n * Obliterator Iterator Class\n * ===========================\n *\n * Simple class representing the library's iterators.\n */\n\n/**\n * Iterator class.\n *\n * @constructor\n * @param {function} next - Next function.\n */\nfunction Iterator(next) {\n if (typeof next !== 'function')\n throw new Error('obliterator/iterator: expecting a function!');\n\n this.next = next;\n}\n\n/**\n * If symbols are supported, we add `next` to `Symbol.iterator`.\n */\nif (typeof Symbol !== 'undefined')\n Iterator.prototype[Symbol.iterator] = function () {\n return this;\n };\n\n/**\n * Returning an iterator of the given values.\n *\n * @param {any...} values - Values.\n * @return {Iterator}\n */\nIterator.of = function () {\n var args = arguments,\n l = args.length,\n i = 0;\n\n return new Iterator(function () {\n if (i >= l) return {done: true};\n\n return {done: false, value: args[i++]};\n });\n};\n\n/**\n * Returning an empty iterator.\n *\n * @return {Iterator}\n */\nIterator.empty = function () {\n var iterator = new Iterator(function () {\n return {done: true};\n });\n\n return iterator;\n};\n\n/**\n * Returning an iterator over the given indexed sequence.\n *\n * @param {string|Array} sequence - Target sequence.\n * @return {Iterator}\n */\nIterator.fromSequence = function (sequence) {\n var i = 0,\n l = sequence.length;\n\n return new Iterator(function () {\n if (i >= l) return {done: true};\n\n return {done: false, value: sequence[i++]};\n });\n};\n\n/**\n * Returning whether the given value is an iterator.\n *\n * @param {any} value - Value.\n * @return {boolean}\n */\nIterator.is = function (value) {\n if (value instanceof Iterator) return true;\n\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof value.next === 'function'\n );\n};\n\n/**\n * Exporting.\n */\nmodule.exports = Iterator;\n","/**\n * Mnemonist Typed Array Helpers\n * ==============================\n *\n * Miscellaneous helpers related to typed arrays.\n */\n\n/**\n * When using an unsigned integer array to store pointers, one might want to\n * choose the optimal word size in regards to the actual numbers of pointers\n * to store.\n *\n * This helpers does just that.\n *\n * @param {number} size - Expected size of the array to map.\n * @return {TypedArray}\n */\nvar MAX_8BIT_INTEGER = Math.pow(2, 8) - 1,\n MAX_16BIT_INTEGER = Math.pow(2, 16) - 1,\n MAX_32BIT_INTEGER = Math.pow(2, 32) - 1;\n\nvar MAX_SIGNED_8BIT_INTEGER = Math.pow(2, 7) - 1,\n MAX_SIGNED_16BIT_INTEGER = Math.pow(2, 15) - 1,\n MAX_SIGNED_32BIT_INTEGER = Math.pow(2, 31) - 1;\n\nexports.getPointerArray = function(size) {\n var maxIndex = size - 1;\n\n if (maxIndex <= MAX_8BIT_INTEGER)\n return Uint8Array;\n\n if (maxIndex <= MAX_16BIT_INTEGER)\n return Uint16Array;\n\n if (maxIndex <= MAX_32BIT_INTEGER)\n return Uint32Array;\n\n throw new Error('mnemonist: Pointer Array of size > 4294967295 is not supported.');\n};\n\nexports.getSignedPointerArray = function(size) {\n var maxIndex = size - 1;\n\n if (maxIndex <= MAX_SIGNED_8BIT_INTEGER)\n return Int8Array;\n\n if (maxIndex <= MAX_SIGNED_16BIT_INTEGER)\n return Int16Array;\n\n if (maxIndex <= MAX_SIGNED_32BIT_INTEGER)\n return Int32Array;\n\n return Float64Array;\n};\n\n/**\n * Function returning the minimal type able to represent the given number.\n *\n * @param {number} value - Value to test.\n * @return {TypedArrayClass}\n */\nexports.getNumberType = function(value) {\n\n // <= 32 bits itnteger?\n if (value === (value | 0)) {\n\n // Negative\n if (Math.sign(value) === -1) {\n if (value <= 127 && value >= -128)\n return Int8Array;\n\n if (value <= 32767 && value >= -32768)\n return Int16Array;\n\n return Int32Array;\n }\n else {\n\n if (value <= 255)\n return Uint8Array;\n\n if (value <= 65535)\n return Uint16Array;\n\n return Uint32Array;\n }\n }\n\n // 53 bits integer & floats\n // NOTE: it's kinda hard to tell whether we could use 32bits or not...\n return Float64Array;\n};\n\n/**\n * Function returning the minimal type able to represent the given array\n * of JavaScript numbers.\n *\n * @param {array} array - Array to represent.\n * @param {function} getter - Optional getter.\n * @return {TypedArrayClass}\n */\nvar TYPE_PRIORITY = {\n Uint8Array: 1,\n Int8Array: 2,\n Uint16Array: 3,\n Int16Array: 4,\n Uint32Array: 5,\n Int32Array: 6,\n Float32Array: 7,\n Float64Array: 8\n};\n\n// TODO: make this a one-shot for one value\nexports.getMinimalRepresentation = function(array, getter) {\n var maxType = null,\n maxPriority = 0,\n p,\n t,\n v,\n i,\n l;\n\n for (i = 0, l = array.length; i < l; i++) {\n v = getter ? getter(array[i]) : array[i];\n t = exports.getNumberType(v);\n p = TYPE_PRIORITY[t.name];\n\n if (p > maxPriority) {\n maxPriority = p;\n maxType = t;\n }\n }\n\n return maxType;\n};\n\n/**\n * Function returning whether the given value is a typed array.\n *\n * @param {any} value - Value to test.\n * @return {boolean}\n */\nexports.isTypedArray = function(value) {\n return typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView(value);\n};\n\n/**\n * Function used to concat byte arrays.\n *\n * @param {...ByteArray}\n * @return {ByteArray}\n */\nexports.concat = function() {\n var length = 0,\n i,\n o,\n l;\n\n for (i = 0, l = arguments.length; i < l; i++)\n length += arguments[i].length;\n\n var array = new (arguments[0].constructor)(length);\n\n for (i = 0, o = 0; i < l; i++) {\n array.set(arguments[i], o);\n o += arguments[i].length;\n }\n\n return array;\n};\n\n/**\n * Function used to initialize a byte array of indices.\n *\n * @param {number} length - Length of target.\n * @return {ByteArray}\n */\nexports.indices = function(length) {\n var PointerArray = exports.getPointerArray(length);\n\n var array = new PointerArray(length);\n\n for (var i = 0; i < length; i++)\n array[i] = i;\n\n return array;\n};\n","/**\n * Mnemonist SparseMap\n * ====================\n *\n * JavaScript sparse map implemented on top of byte arrays.\n *\n * [Reference]: https://research.swtch.com/sparse\n */\nvar Iterator = require('obliterator/iterator'),\n getPointerArray = require('./utils/typed-arrays.js').getPointerArray;\n\n/**\n * SparseMap.\n *\n * @constructor\n */\nfunction SparseMap(Values, length) {\n if (arguments.length < 2) {\n length = Values;\n Values = Array;\n }\n\n var ByteArray = getPointerArray(length);\n\n // Properties\n this.size = 0;\n this.length = length;\n this.dense = new ByteArray(length);\n this.sparse = new ByteArray(length);\n this.vals = new Values(length);\n}\n\n/**\n * Method used to clear the structure.\n *\n * @return {undefined}\n */\nSparseMap.prototype.clear = function() {\n this.size = 0;\n};\n\n/**\n * Method used to check the existence of a member in the set.\n *\n * @param {number} member - Member to test.\n * @return {SparseMap}\n */\nSparseMap.prototype.has = function(member) {\n var index = this.sparse[member];\n\n return (\n index < this.size &&\n this.dense[index] === member\n );\n};\n\n/**\n * Method used to get the value associated to a member in the set.\n *\n * @param {number} member - Member to test.\n * @return {any}\n */\nSparseMap.prototype.get = function(member) {\n var index = this.sparse[member];\n\n if (index < this.size && this.dense[index] === member)\n return this.vals[index];\n\n return;\n};\n\n/**\n * Method used to set a value into the map.\n *\n * @param {number} member - Member to set.\n * @param {any} value - Associated value.\n * @return {SparseMap}\n */\nSparseMap.prototype.set = function(member, value) {\n var index = this.sparse[member];\n\n if (index < this.size && this.dense[index] === member) {\n this.vals[index] = value;\n return this;\n }\n\n this.dense[this.size] = member;\n this.sparse[member] = this.size;\n this.vals[this.size] = value;\n this.size++;\n\n return this;\n};\n\n/**\n * Method used to remove a member from the set.\n *\n * @param {number} member - Member to delete.\n * @return {boolean}\n */\nSparseMap.prototype.delete = function(member) {\n var index = this.sparse[member];\n\n if (index >= this.size || this.dense[index] !== member)\n return false;\n\n index = this.dense[this.size - 1];\n this.dense[this.sparse[member]] = index;\n this.sparse[index] = this.sparse[member];\n this.size--;\n\n return true;\n};\n\n/**\n * Method used to iterate over the set's values.\n *\n * @param {function} callback - Function to call for each item.\n * @param {object} scope - Optional scope.\n * @return {undefined}\n */\nSparseMap.prototype.forEach = function(callback, scope) {\n scope = arguments.length > 1 ? scope : this;\n\n for (var i = 0; i < this.size; i++)\n callback.call(scope, this.vals[i], this.dense[i]);\n};\n\n/**\n * Method used to create an iterator over a set's members.\n *\n * @return {Iterator}\n */\nSparseMap.prototype.keys = function() {\n var size = this.size,\n dense = this.dense,\n i = 0;\n\n return new Iterator(function() {\n if (i < size) {\n var item = dense[i];\n i++;\n\n return {\n value: item\n };\n }\n\n return {\n done: true\n };\n });\n};\n\n/**\n * Method used to create an iterator over a set's values.\n *\n * @return {Iterator}\n */\nSparseMap.prototype.values = function() {\n var size = this.size,\n values = this.vals,\n i = 0;\n\n return new Iterator(function() {\n if (i < size) {\n var item = values[i];\n i++;\n\n return {\n value: item\n };\n }\n\n return {\n done: true\n };\n });\n};\n\n/**\n * Method used to create an iterator over a set's entries.\n *\n * @return {Iterator}\n */\nSparseMap.prototype.entries = function() {\n var size = this.size,\n dense = this.dense,\n values = this.vals,\n i = 0;\n\n return new Iterator(function() {\n if (i < size) {\n var item = [dense[i], values[i]];\n i++;\n\n return {\n value: item\n };\n }\n\n return {\n done: true\n };\n });\n};\n\n/**\n * Attaching the #.entries method to Symbol.iterator if possible.\n */\nif (typeof Symbol !== 'undefined')\n SparseMap.prototype[Symbol.iterator] = SparseMap.prototype.entries;\n\n/**\n * Convenience known methods.\n */\nSparseMap.prototype.inspect = function() {\n var proxy = new Map();\n\n for (var i = 0; i < this.size; i++)\n proxy.set(this.dense[i], this.vals[i]);\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: SparseMap,\n enumerable: false\n });\n\n proxy.length = this.length;\n\n if (this.vals.constructor !== Array)\n proxy.type = this.vals.constructor.name;\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n SparseMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = SparseMap.prototype.inspect;\n\n/**\n * Exporting.\n */\nmodule.exports = SparseMap;\n","/**\n * Mnemonist SparseQueueSet\n * =========================\n *\n * JavaScript sparse queue set implemented on top of byte arrays.\n *\n * [Reference]: https://research.swtch.com/sparse\n */\nvar Iterator = require('obliterator/iterator'),\n getPointerArray = require('./utils/typed-arrays.js').getPointerArray;\n\n/**\n * SparseQueueSet.\n *\n * @constructor\n */\nfunction SparseQueueSet(capacity) {\n\n var ByteArray = getPointerArray(capacity);\n\n // Properties\n this.start = 0;\n this.size = 0;\n this.capacity = capacity;\n this.dense = new ByteArray(capacity);\n this.sparse = new ByteArray(capacity);\n}\n\n/**\n * Method used to clear the structure.\n *\n * @return {undefined}\n */\nSparseQueueSet.prototype.clear = function() {\n this.start = 0;\n this.size = 0;\n};\n\n/**\n * Method used to check the existence of a member in the queue.\n *\n * @param {number} member - Member to test.\n * @return {SparseQueueSet}\n */\nSparseQueueSet.prototype.has = function(member) {\n if (this.size === 0)\n return false;\n\n var index = this.sparse[member];\n\n var inBounds = (\n index < this.capacity &&\n (\n index >= this.start &&\n index < this.start + this.size\n ) ||\n (\n index < ((this.start + this.size) % this.capacity)\n )\n );\n\n return (\n inBounds &&\n this.dense[index] === member\n );\n};\n\n/**\n * Method used to add a member to the queue.\n *\n * @param {number} member - Member to add.\n * @return {SparseQueueSet}\n */\nSparseQueueSet.prototype.enqueue = function(member) {\n var index = this.sparse[member];\n\n if (this.size !== 0) {\n var inBounds = (\n index < this.capacity &&\n (\n index >= this.start &&\n index < this.start + this.size\n ) ||\n (\n index < ((this.start + this.size) % this.capacity)\n )\n );\n\n if (inBounds && this.dense[index] === member)\n return this;\n }\n\n index = (this.start + this.size) % this.capacity;\n\n this.dense[index] = member;\n this.sparse[member] = index;\n this.size++;\n\n return this;\n};\n\n/**\n * Method used to remove the next member from the queue.\n *\n * @param {number} member - Member to delete.\n * @return {boolean}\n */\nSparseQueueSet.prototype.dequeue = function() {\n if (this.size === 0)\n return;\n\n var index = this.start;\n\n this.size--;\n this.start++;\n\n if (this.start === this.capacity)\n this.start = 0;\n\n var member = this.dense[index];\n\n this.sparse[member] = this.capacity;\n\n return member;\n};\n\n/**\n * Method used to iterate over the queue's values.\n *\n * @param {function} callback - Function to call for each item.\n * @param {object} scope - Optional scope.\n * @return {undefined}\n */\nSparseQueueSet.prototype.forEach = function(callback, scope) {\n scope = arguments.length > 1 ? scope : this;\n\n var c = this.capacity,\n l = this.size,\n i = this.start,\n j = 0;\n\n while (j < l) {\n callback.call(scope, this.dense[i], j, this);\n i++;\n j++;\n\n if (i === c)\n i = 0;\n }\n};\n\n/**\n * Method used to create an iterator over a set's values.\n *\n * @return {Iterator}\n */\nSparseQueueSet.prototype.values = function() {\n var dense = this.dense,\n c = this.capacity,\n l = this.size,\n i = this.start,\n j = 0;\n\n return new Iterator(function() {\n if (j >= l)\n return {\n done: true\n };\n\n var value = dense[i];\n\n i++;\n j++;\n\n if (i === c)\n i = 0;\n\n return {\n value: value,\n done: false\n };\n });\n};\n\n/**\n * Attaching the #.values method to Symbol.iterator if possible.\n */\nif (typeof Symbol !== 'undefined')\n SparseQueueSet.prototype[Symbol.iterator] = SparseQueueSet.prototype.values;\n\n/**\n * Convenience known methods.\n */\nSparseQueueSet.prototype.inspect = function() {\n var proxy = [];\n\n this.forEach(function(member) {\n proxy.push(member);\n });\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: SparseQueueSet,\n enumerable: false\n });\n\n proxy.capacity = this.capacity;\n\n return proxy;\n};\n\nif (typeof Symbol !== 'undefined')\n SparseQueueSet.prototype[Symbol.for('nodejs.util.inspect.custom')] = SparseQueueSet.prototype.inspect;\n\n/**\n * Exporting.\n */\nmodule.exports = SparseQueueSet;\n","/**\n * Pandemonium Random Index\n * =========================\n *\n * Random index function.\n */\n\n/**\n * Creating a function returning a random index from the given array.\n *\n * @param {function} rng - RNG function returning uniform random.\n * @return {function} - The created function.\n */\nfunction createRandomIndex(rng) {\n /**\n * Random function.\n *\n * @param {array|number} array - Target array or length of the array.\n * @return {number}\n */\n return function (length) {\n if (typeof length !== 'number') length = length.length;\n\n return Math.floor(rng() * length);\n };\n}\n\n/**\n * Default random index using `Math.random`.\n */\nvar randomIndex = createRandomIndex(Math.random);\n\n/**\n * Exporting.\n */\nrandomIndex.createRandomIndex = createRandomIndex;\nmodule.exports = randomIndex;\n","/**\n * Graphology Weight Getter\n * =========================\n *\n * Function creating weight getters.\n */\nfunction coerceWeight(value) {\n // Ensuring target value is a correct number\n if (typeof value !== 'number' || isNaN(value)) return 1;\n\n return value;\n}\n\nfunction createNodeValueGetter(nameOrFunction, defaultValue) {\n var getter = {};\n\n var coerceToDefault = function (v) {\n if (typeof v === 'undefined') return defaultValue;\n\n return v;\n };\n\n if (typeof defaultValue === 'function') coerceToDefault = defaultValue;\n\n var get = function (attributes) {\n return coerceToDefault(attributes[nameOrFunction]);\n };\n\n var returnDefault = function () {\n return coerceToDefault(undefined);\n };\n\n if (typeof nameOrFunction === 'string') {\n getter.fromAttributes = get;\n getter.fromGraph = function (graph, node) {\n return get(graph.getNodeAttributes(node));\n };\n getter.fromEntry = function (node, attributes) {\n return get(attributes);\n };\n } else if (typeof nameOrFunction === 'function') {\n getter.fromAttributes = function () {\n throw new Error(\n 'graphology-utils/getters/createNodeValueGetter: irrelevant usage.'\n );\n };\n getter.fromGraph = function (graph, node) {\n return coerceToDefault(\n nameOrFunction(node, graph.getNodeAttributes(node))\n );\n };\n getter.fromEntry = function (node, attributes) {\n return coerceToDefault(nameOrFunction(node, attributes));\n };\n } else {\n getter.fromAttributes = returnDefault;\n getter.fromGraph = returnDefault;\n getter.fromEntry = returnDefault;\n }\n\n return getter;\n}\n\nfunction createEdgeValueGetter(nameOrFunction, defaultValue) {\n var getter = {};\n\n var coerceToDefault = function (v) {\n if (typeof v === 'undefined') return defaultValue;\n\n return v;\n };\n\n if (typeof defaultValue === 'function') coerceToDefault = defaultValue;\n\n var get = function (attributes) {\n return coerceToDefault(attributes[nameOrFunction]);\n };\n\n var returnDefault = function () {\n return coerceToDefault(undefined);\n };\n\n if (typeof nameOrFunction === 'string') {\n getter.fromAttributes = get;\n getter.fromGraph = function (graph, edge) {\n return get(graph.getEdgeAttributes(edge));\n };\n getter.fromEntry = function (edge, attributes) {\n return get(attributes);\n };\n getter.fromPartialEntry = getter.fromEntry;\n getter.fromMinimalEntry = getter.fromEntry;\n } else if (typeof nameOrFunction === 'function') {\n getter.fromAttributes = function () {\n throw new Error(\n 'graphology-utils/getters/createEdgeValueGetter: irrelevant usage.'\n );\n };\n getter.fromGraph = function (graph, edge) {\n // TODO: we can do better, check #310\n var extremities = graph.extremities(edge);\n return coerceToDefault(\n nameOrFunction(\n edge,\n graph.getEdgeAttributes(edge),\n extremities[0],\n extremities[1],\n graph.getNodeAttributes(extremities[0]),\n graph.getNodeAttributes(extremities[1]),\n graph.isUndirected(edge)\n )\n );\n };\n getter.fromEntry = function (e, a, s, t, sa, ta, u) {\n return coerceToDefault(nameOrFunction(e, a, s, t, sa, ta, u));\n };\n getter.fromPartialEntry = function (e, a, s, t) {\n return coerceToDefault(nameOrFunction(e, a, s, t));\n };\n getter.fromMinimalEntry = function (e, a) {\n return coerceToDefault(nameOrFunction(e, a));\n };\n } else {\n getter.fromAttributes = returnDefault;\n getter.fromGraph = returnDefault;\n getter.fromEntry = returnDefault;\n getter.fromMinimalEntry = returnDefault;\n }\n\n return getter;\n}\n\nexports.createNodeValueGetter = createNodeValueGetter;\nexports.createEdgeValueGetter = createEdgeValueGetter;\nexports.createEdgeWeightGetter = function (name) {\n return createEdgeValueGetter(name, coerceWeight);\n};\n","/**\n * Graphology Louvain Indices\n * ===========================\n *\n * Undirected & Directed Louvain Index structures used to compute the famous\n * Louvain community detection algorithm.\n *\n * Most of the rationale is explained in `graphology-metrics`.\n *\n * Note that this index shares a lot with the classic Union-Find data\n * structure. It also relies on a unused id stack to make sure we can\n * increase again the number of communites when isolating nodes.\n *\n * [Articles]\n * M. E. J. Newman, « Modularity and community structure in networks »,\n * Proc. Natl. Acad. Sci. USA, vol. 103, no 23, 2006, p. 8577–8582\n * https://dx.doi.org/10.1073%2Fpnas.0601602103\n *\n * Newman, M. E. J. « Community detection in networks: Modularity optimization\n * and maximum likelihood are equivalent ». Physical Review E, vol. 94, no 5,\n * novembre 2016, p. 052315. arXiv.org, doi:10.1103/PhysRevE.94.052315.\n * https://arxiv.org/pdf/1606.02319.pdf\n *\n * Blondel, Vincent D., et al. « Fast unfolding of communities in large\n * networks ». Journal of Statistical Mechanics: Theory and Experiment,\n * vol. 2008, no 10, octobre 2008, p. P10008. DOI.org (Crossref),\n * doi:10.1088/1742-5468/2008/10/P10008.\n * https://arxiv.org/pdf/0803.0476.pdf\n *\n * Nicolas Dugué, Anthony Perez. Directed Louvain: maximizing modularity in\n * directed networks. [Research Report] Université d’Orléans. 2015. hal-01231784\n * https://hal.archives-ouvertes.fr/hal-01231784\n *\n * R. Lambiotte, J.-C. Delvenne and M. Barahona. Laplacian Dynamics and\n * Multiscale Modular Structure in Networks,\n * doi:10.1109/TNSE.2015.2391998.\n * https://arxiv.org/abs/0812.1770\n *\n * [Latex]:\n *\n * Undirected Case:\n * ----------------\n *\n * \\Delta Q=\\bigg{[}\\frac{\\sum^{c}_{in}-(2d_{c}+l)}{2m}-\\bigg{(}\\frac{\\sum^{c}_{tot}-(d+l)}{2m}\\bigg{)}^{2}+\\frac{\\sum^{t}_{in}+(2d_{t}+l)}{2m}-\\bigg{(}\\frac{\\sum^{t}_{tot}+(d+l)}{2m}\\bigg{)}^{2}\\bigg{]}-\\bigg{[}\\frac{\\sum^{c}_{in}}{2m}-\\bigg{(}\\frac{\\sum^{c}_{tot}}{2m}\\bigg{)}^{2}+\\frac{\\sum^{t}_{in}}{2m}-\\bigg{(}\\frac{\\sum^{t}_{tot}}{2m}\\bigg{)}^{2}\\bigg{]}\n * \\Delta Q=\\frac{d_{t}-d_{c}}{m}+\\frac{l\\sum^{c}_{tot}+d\\sum^{c}_{tot}-d^{2}-l^{2}-2dl-l\\sum^{t}_{tot}-d\\sum^{t}_{tot}}{2m^{2}}\n * \\Delta Q=\\frac{d_{t}-d_{c}}{m}+\\frac{(l+d)\\sum^{c}_{tot}-d^{2}-l^{2}-2dl-(l+d)\\sum^{t}_{tot}}{2m^{2}}\n *\n * Directed Case:\n * --------------\n * \\Delta Q_d=\\bigg{[}\\frac{\\sum^{c}_{in}-(d_{c.in}+d_{c.out}+l)}{m}-\\frac{(\\sum^{c}_{tot.in}-(d_{in}+l))(\\sum^{c}_{tot.out}-(d_{out}+l))}{m^{2}}+\\frac{\\sum^{t}_{in}+(d_{t.in}+d_{t.out}+l)}{m}-\\frac{(\\sum^{t}_{tot.in}+(d_{in}+l))(\\sum^{t}_{tot.out}+(d_{out}+l))}{m^{2}}\\bigg{]}-\\bigg{[}\\frac{\\sum^{c}_{in}}{m}-\\frac{\\sum^{c}_{tot.in}\\sum^{c}_{tot.out}}{m^{2}}+\\frac{\\sum^{t}_{in}}{m}-\\frac{\\sum^{t}_{tot.in}\\sum^{t}_{tot.out}}{m^{2}}\\bigg{]}\n *\n * [Notes]:\n * Louvain is a bit unclear on this but delta computation are not derived from\n * Q1 - Q2 but rather between Q when considered node is isolated in its own\n * community versus Q with this node in target community. This is in fact\n * an optimization because the subtract part is constant in the formulae and\n * does not affect delta comparisons.\n */\nvar typed = require('mnemonist/utils/typed-arrays');\nvar resolveDefaults = require('graphology-utils/defaults');\nvar createEdgeWeightGetter =\n require('graphology-utils/getters').createEdgeWeightGetter;\n\nvar INSPECT = Symbol.for('nodejs.util.inspect.custom');\n\nvar DEFAULTS = {\n getEdgeWeight: 'weight',\n keepDendrogram: false,\n resolution: 1\n};\n\nfunction UndirectedLouvainIndex(graph, options) {\n // Solving options\n options = resolveDefaults(options, DEFAULTS);\n\n var resolution = options.resolution;\n\n // Weight getters\n var getEdgeWeight = createEdgeWeightGetter(options.getEdgeWeight).fromEntry;\n\n // Building the index\n var size = (graph.size - graph.selfLoopCount) * 2;\n\n var NeighborhoodPointerArray = typed.getPointerArray(size);\n var NodesPointerArray = typed.getPointerArray(graph.order + 1);\n\n // NOTE: this memory optimization can yield overflow deopt when computing deltas\n var WeightsArray = options.getEdgeWeight\n ? Float64Array\n : typed.getPointerArray(graph.size * 2);\n\n // Properties\n this.C = graph.order;\n this.M = 0;\n this.E = size;\n this.U = 0;\n this.resolution = resolution;\n this.level = 0;\n this.graph = graph;\n this.nodes = new Array(graph.order);\n this.keepDendrogram = options.keepDendrogram;\n\n // Edge-level\n this.neighborhood = new NodesPointerArray(size);\n this.weights = new WeightsArray(size);\n\n // Node-level\n this.loops = new WeightsArray(graph.order);\n this.starts = new NeighborhoodPointerArray(graph.order + 1);\n this.belongings = new NodesPointerArray(graph.order);\n this.dendrogram = [];\n this.mapping = null;\n\n // Community-level\n this.counts = new NodesPointerArray(graph.order);\n this.unused = new NodesPointerArray(graph.order);\n this.totalWeights = new WeightsArray(graph.order);\n\n var ids = {};\n\n var weight;\n\n var i = 0,\n n = 0;\n\n var self = this;\n\n graph.forEachNode(function (node) {\n self.nodes[i] = node;\n\n // Node map to index\n ids[node] = i;\n\n // Initializing starts\n n += graph.undirectedDegreeWithoutSelfLoops(node);\n self.starts[i] = n;\n\n // Belongings\n self.belongings[i] = i;\n self.counts[i] = 1;\n i++;\n });\n\n // Single sweep over the edges\n graph.forEachEdge(function (edge, attr, source, target, sa, ta, u) {\n weight = getEdgeWeight(edge, attr, source, target, sa, ta, u);\n\n source = ids[source];\n target = ids[target];\n\n self.M += weight;\n\n // Self loop?\n if (source === target) {\n self.totalWeights[source] += weight * 2;\n self.loops[source] = weight * 2;\n } else {\n self.totalWeights[source] += weight;\n self.totalWeights[target] += weight;\n\n var startSource = --self.starts[source],\n startTarget = --self.starts[target];\n\n self.neighborhood[startSource] = target;\n self.neighborhood[startTarget] = source;\n\n self.weights[startSource] = weight;\n self.weights[startTarget] = weight;\n }\n });\n\n this.starts[i] = this.E;\n\n if (this.keepDendrogram) this.dendrogram.push(this.belongings.slice());\n else this.mapping = this.belongings.slice();\n}\n\nUndirectedLouvainIndex.prototype.isolate = function (i, degree) {\n var currentCommunity = this.belongings[i];\n\n // The node is already isolated\n if (this.counts[currentCommunity] === 1) return currentCommunity;\n\n var newCommunity = this.unused[--this.U];\n\n var loops = this.loops[i];\n\n this.totalWeights[currentCommunity] -= degree + loops;\n this.totalWeights[newCommunity] += degree + loops;\n\n this.belongings[i] = newCommunity;\n\n this.counts[currentCommunity]--;\n this.counts[newCommunity]++;\n\n return newCommunity;\n};\n\nUndirectedLouvainIndex.prototype.move = function (i, degree, targetCommunity) {\n var currentCommunity = this.belongings[i],\n loops = this.loops[i];\n\n this.totalWeights[currentCommunity] -= degree + loops;\n this.totalWeights[targetCommunity] += degree + loops;\n\n this.belongings[i] = targetCommunity;\n\n var nowEmpty = this.counts[currentCommunity]-- === 1;\n this.counts[targetCommunity]++;\n\n if (nowEmpty) this.unused[this.U++] = currentCommunity;\n};\n\nUndirectedLouvainIndex.prototype.computeNodeDegree = function (i) {\n var o, l, weight;\n\n var degree = 0;\n\n for (o = this.starts[i], l = this.starts[i + 1]; o < l; o++) {\n weight = this.weights[o];\n\n degree += weight;\n }\n\n return degree;\n};\n\nUndirectedLouvainIndex.prototype.expensiveIsolate = function (i) {\n var degree = this.computeNodeDegree(i);\n return this.isolate(i, degree);\n};\n\nUndirectedLouvainIndex.prototype.expensiveMove = function (i, ci) {\n var degree = this.computeNodeDegree(i);\n this.move(i, degree, ci);\n};\n\nUndirectedLouvainIndex.prototype.zoomOut = function () {\n var inducedGraph = new Array(this.C - this.U),\n newLabels = {};\n\n var N = this.nodes.length;\n\n var C = 0,\n E = 0;\n\n var i, j, l, m, n, ci, cj, data, adj;\n\n // Renumbering communities\n for (i = 0, l = this.C; i < l; i++) {\n ci = this.belongings[i];\n\n if (!(ci in newLabels)) {\n newLabels[ci] = C;\n inducedGraph[C] = {\n adj: {},\n totalWeights: this.totalWeights[ci],\n internalWeights: 0\n };\n C++;\n }\n\n // We do this to otpimize the number of lookups in next loop\n this.belongings[i] = newLabels[ci];\n }\n\n // Actualizing dendrogram\n var currentLevel, nextLevel;\n\n if (this.keepDendrogram) {\n currentLevel = this.dendrogram[this.level];\n nextLevel = new (typed.getPointerArray(C))(N);\n\n for (i = 0; i < N; i++) nextLevel[i] = this.belongings[currentLevel[i]];\n\n this.dendrogram.push(nextLevel);\n } else {\n for (i = 0; i < N; i++) this.mapping[i] = this.belongings[this.mapping[i]];\n }\n\n // Building induced graph matrix\n for (i = 0, l = this.C; i < l; i++) {\n ci = this.belongings[i];\n\n data = inducedGraph[ci];\n adj = data.adj;\n data.internalWeights += this.loops[i];\n\n for (j = this.starts[i], m = this.starts[i + 1]; j < m; j++) {\n n = this.neighborhood[j];\n cj = this.belongings[n];\n\n if (ci === cj) {\n data.internalWeights += this.weights[j];\n continue;\n }\n\n if (!(cj in adj)) adj[cj] = 0;\n\n adj[cj] += this.weights[j];\n }\n }\n\n // Rewriting neighborhood\n this.C = C;\n\n n = 0;\n\n for (ci = 0; ci < C; ci++) {\n data = inducedGraph[ci];\n adj = data.adj;\n\n ci = +ci;\n\n this.totalWeights[ci] = data.totalWeights;\n this.loops[ci] = data.internalWeights;\n this.counts[ci] = 1;\n\n this.starts[ci] = n;\n this.belongings[ci] = ci;\n\n for (cj in adj) {\n this.neighborhood[n] = +cj;\n this.weights[n] = adj[cj];\n\n E++;\n n++;\n }\n }\n\n this.starts[C] = E;\n\n this.E = E;\n this.U = 0;\n this.level++;\n\n return newLabels;\n};\n\nUndirectedLouvainIndex.prototype.modularity = function () {\n var ci, cj, i, j, m;\n\n var Q = 0;\n var M2 = this.M * 2;\n var internalWeights = new Float64Array(this.C);\n\n for (i = 0; i < this.C; i++) {\n ci = this.belongings[i];\n internalWeights[ci] += this.loops[i];\n\n for (j = this.starts[i], m = this.starts[i + 1]; j < m; j++) {\n cj = this.belongings[this.neighborhood[j]];\n\n if (ci !== cj) continue;\n\n internalWeights[ci] += this.weights[j];\n }\n }\n\n for (i = 0; i < this.C; i++) {\n Q +=\n internalWeights[i] / M2 -\n Math.pow(this.totalWeights[i] / M2, 2) * this.resolution;\n }\n\n return Q;\n};\n\nUndirectedLouvainIndex.prototype.delta = function (\n i,\n degree,\n targetCommunityDegree,\n targetCommunity\n) {\n var M = this.M;\n\n var targetCommunityTotalWeight = this.totalWeights[targetCommunity];\n\n degree += this.loops[i];\n\n return (\n targetCommunityDegree / M - // NOTE: formula is a bit different here because targetCommunityDegree is passed without * 2\n (targetCommunityTotalWeight * degree * this.resolution) / (2 * M * M)\n );\n};\n\nUndirectedLouvainIndex.prototype.deltaWithOwnCommunity = function (\n i,\n degree,\n targetCommunityDegree,\n targetCommunity\n) {\n var M = this.M;\n\n var targetCommunityTotalWeight = this.totalWeights[targetCommunity];\n\n degree += this.loops[i];\n\n return (\n targetCommunityDegree / M - // NOTE: formula is a bit different here because targetCommunityDegree is passed without * 2\n ((targetCommunityTotalWeight - degree) * degree * this.resolution) /\n (2 * M * M)\n );\n};\n\n// NOTE: this is just a faster but equivalent version of #.delta\n// It is just off by a constant factor and is just faster to compute\nUndirectedLouvainIndex.prototype.fastDelta = function (\n i,\n degree,\n targetCommunityDegree,\n targetCommunity\n) {\n var M = this.M;\n\n var targetCommunityTotalWeight = this.totalWeights[targetCommunity];\n\n degree += this.loops[i];\n\n return (\n targetCommunityDegree -\n (degree * targetCommunityTotalWeight * this.resolution) / (2 * M)\n );\n};\n\nUndirectedLouvainIndex.prototype.fastDeltaWithOwnCommunity = function (\n i,\n degree,\n targetCommunityDegree,\n targetCommunity\n) {\n var M = this.M;\n\n var targetCommunityTotalWeight = this.totalWeights[targetCommunity];\n\n degree += this.loops[i];\n\n return (\n targetCommunityDegree -\n (degree * (targetCommunityTotalWeight - degree) * this.resolution) / (2 * M)\n );\n};\n\nUndirectedLouvainIndex.prototype.bounds = function (i) {\n return [this.starts[i], this.starts[i + 1]];\n};\n\nUndirectedLouvainIndex.prototype.project = function () {\n var self = this;\n\n var projection = {};\n\n self.nodes.slice(0, this.C).forEach(function (node, i) {\n projection[node] = Array.from(\n self.neighborhood.slice(self.starts[i], self.starts[i + 1])\n ).map(function (j) {\n return self.nodes[j];\n });\n });\n\n return projection;\n};\n\nUndirectedLouvainIndex.prototype.collect = function (level) {\n if (arguments.length < 1) level = this.level;\n\n var o = {};\n\n var mapping = this.keepDendrogram ? this.dendrogram[level] : this.mapping;\n\n var i, l;\n\n for (i = 0, l = mapping.length; i < l; i++) o[this.nodes[i]] = mapping[i];\n\n return o;\n};\n\nUndirectedLouvainIndex.prototype.assign = function (prop, level) {\n if (arguments.length < 2) level = this.level;\n\n var mapping = this.keepDendrogram ? this.dendrogram[level] : this.mapping;\n\n var i, l;\n\n for (i = 0, l = mapping.length; i < l; i++)\n this.graph.setNodeAttribute(this.nodes[i], prop, mapping[i]);\n};\n\nUndirectedLouvainIndex.prototype[INSPECT] = function () {\n var proxy = {};\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: UndirectedLouvainIndex,\n enumerable: false\n });\n\n proxy.C = this.C;\n proxy.M = this.M;\n proxy.E = this.E;\n proxy.U = this.U;\n proxy.resolution = this.resolution;\n proxy.level = this.level;\n proxy.nodes = this.nodes;\n proxy.starts = this.starts.slice(0, proxy.C + 1);\n\n var eTruncated = ['neighborhood', 'weights'];\n var cTruncated = ['counts', 'loops', 'belongings', 'totalWeights'];\n\n var self = this;\n\n eTruncated.forEach(function (key) {\n proxy[key] = self[key].slice(0, proxy.E);\n });\n\n cTruncated.forEach(function (key) {\n proxy[key] = self[key].slice(0, proxy.C);\n });\n\n proxy.unused = this.unused.slice(0, this.U);\n\n if (this.keepDendrogram) proxy.dendrogram = this.dendrogram;\n else proxy.mapping = this.mapping;\n\n return proxy;\n};\n\nfunction DirectedLouvainIndex(graph, options) {\n // Solving options\n options = resolveDefaults(options, DEFAULTS);\n\n var resolution = options.resolution;\n\n // Weight getters\n var getEdgeWeight = createEdgeWeightGetter(options.getEdgeWeight).fromEntry;\n\n // Building the index\n var size = (graph.size - graph.selfLoopCount) * 2;\n\n var NeighborhoodPointerArray = typed.getPointerArray(size);\n var NodesPointerArray = typed.getPointerArray(graph.order + 1);\n\n // NOTE: this memory optimization can yield overflow deopt when computing deltas\n var WeightsArray = options.getEdgeWeight\n ? Float64Array\n : typed.getPointerArray(graph.size * 2);\n\n // Properties\n this.C = graph.order;\n this.M = 0;\n this.E = size;\n this.U = 0;\n this.resolution = resolution;\n this.level = 0;\n this.graph = graph;\n this.nodes = new Array(graph.order);\n this.keepDendrogram = options.keepDendrogram;\n\n // Edge-level\n // NOTE: edges are stored out then in, in this order\n this.neighborhood = new NodesPointerArray(size);\n this.weights = new WeightsArray(size);\n\n // Node-level\n this.loops = new WeightsArray(graph.order);\n this.starts = new NeighborhoodPointerArray(graph.order + 1);\n this.offsets = new NeighborhoodPointerArray(graph.order);\n this.belongings = new NodesPointerArray(graph.order);\n this.dendrogram = [];\n\n // Community-level\n this.counts = new NodesPointerArray(graph.order);\n this.unused = new NodesPointerArray(graph.order);\n this.totalInWeights = new WeightsArray(graph.order);\n this.totalOutWeights = new WeightsArray(graph.order);\n\n var ids = {};\n\n var weight;\n\n var i = 0,\n n = 0;\n\n var self = this;\n\n graph.forEachNode(function (node) {\n self.nodes[i] = node;\n\n // Node map to index\n ids[node] = i;\n\n // Initializing starts & offsets\n n += graph.outDegreeWithoutSelfLoops(node);\n self.starts[i] = n;\n\n n += graph.inDegreeWithoutSelfLoops(node);\n self.offsets[i] = n;\n\n // Belongings\n self.belongings[i] = i;\n self.counts[i] = 1;\n i++;\n });\n\n // Single sweep over the edges\n graph.forEachEdge(function (edge, attr, source, target, sa, ta, u) {\n weight = getEdgeWeight(edge, attr, source, target, sa, ta, u);\n\n source = ids[source];\n target = ids[target];\n\n self.M += weight;\n\n // Self loop?\n if (source === target) {\n self.loops[source] += weight;\n self.totalInWeights[source] += weight;\n self.totalOutWeights[source] += weight;\n } else {\n self.totalOutWeights[source] += weight;\n self.totalInWeights[target] += weight;\n\n var startSource = --self.starts[source],\n startTarget = --self.offsets[target];\n\n self.neighborhood[startSource] = target;\n self.neighborhood[startTarget] = source;\n\n self.weights[startSource] = weight;\n self.weights[startTarget] = weight;\n }\n });\n\n this.starts[i] = this.E;\n\n if (this.keepDendrogram) this.dendrogram.push(this.belongings.slice());\n else this.mapping = this.belongings.slice();\n}\n\nDirectedLouvainIndex.prototype.bounds = UndirectedLouvainIndex.prototype.bounds;\n\nDirectedLouvainIndex.prototype.inBounds = function (i) {\n return [this.offsets[i], this.starts[i + 1]];\n};\n\nDirectedLouvainIndex.prototype.outBounds = function (i) {\n return [this.starts[i], this.offsets[i]];\n};\n\nDirectedLouvainIndex.prototype.project =\n UndirectedLouvainIndex.prototype.project;\n\nDirectedLouvainIndex.prototype.projectIn = function () {\n var self = this;\n\n var projection = {};\n\n self.nodes.slice(0, this.C).forEach(function (node, i) {\n projection[node] = Array.from(\n self.neighborhood.slice(self.offsets[i], self.starts[i + 1])\n ).map(function (j) {\n return self.nodes[j];\n });\n });\n\n return projection;\n};\n\nDirectedLouvainIndex.prototype.projectOut = function () {\n var self = this;\n\n var projection = {};\n\n self.nodes.slice(0, this.C).forEach(function (node, i) {\n projection[node] = Array.from(\n self.neighborhood.slice(self.starts[i], self.offsets[i])\n ).map(function (j) {\n return self.nodes[j];\n });\n });\n\n return projection;\n};\n\nDirectedLouvainIndex.prototype.isolate = function (i, inDegree, outDegree) {\n var currentCommunity = this.belongings[i];\n\n // The node is already isolated\n if (this.counts[currentCommunity] === 1) return currentCommunity;\n\n var newCommunity = this.unused[--this.U];\n\n var loops = this.loops[i];\n\n this.totalInWeights[currentCommunity] -= inDegree + loops;\n this.totalInWeights[newCommunity] += inDegree + loops;\n\n this.totalOutWeights[currentCommunity] -= outDegree + loops;\n this.totalOutWeights[newCommunity] += outDegree + loops;\n\n this.belongings[i] = newCommunity;\n\n this.counts[currentCommunity]--;\n this.counts[newCommunity]++;\n\n return newCommunity;\n};\n\nDirectedLouvainIndex.prototype.move = function (\n i,\n inDegree,\n outDegree,\n targetCommunity\n) {\n var currentCommunity = this.belongings[i],\n loops = this.loops[i];\n\n this.totalInWeights[currentCommunity] -= inDegree + loops;\n this.totalInWeights[targetCommunity] += inDegree + loops;\n\n this.totalOutWeights[currentCommunity] -= outDegree + loops;\n this.totalOutWeights[targetCommunity] += outDegree + loops;\n\n this.belongings[i] = targetCommunity;\n\n var nowEmpty = this.counts[currentCommunity]-- === 1;\n this.counts[targetCommunity]++;\n\n if (nowEmpty) this.unused[this.U++] = currentCommunity;\n};\n\nDirectedLouvainIndex.prototype.computeNodeInDegree = function (i) {\n var o, l, weight;\n\n var inDegree = 0;\n\n for (o = this.offsets[i], l = this.starts[i + 1]; o < l; o++) {\n weight = this.weights[o];\n\n inDegree += weight;\n }\n\n return inDegree;\n};\n\nDirectedLouvainIndex.prototype.computeNodeOutDegree = function (i) {\n var o, l, weight;\n\n var outDegree = 0;\n\n for (o = this.starts[i], l = this.offsets[i]; o < l; o++) {\n weight = this.weights[o];\n\n outDegree += weight;\n }\n\n return outDegree;\n};\n\nDirectedLouvainIndex.prototype.expensiveMove = function (i, ci) {\n var inDegree = this.computeNodeInDegree(i),\n outDegree = this.computeNodeOutDegree(i);\n\n this.move(i, inDegree, outDegree, ci);\n};\n\nDirectedLouvainIndex.prototype.zoomOut = function () {\n var inducedGraph = new Array(this.C - this.U),\n newLabels = {};\n\n var N = this.nodes.length;\n\n var C = 0,\n E = 0;\n\n var i, j, l, m, n, ci, cj, data, offset, out, adj, inAdj, outAdj;\n\n // Renumbering communities\n for (i = 0, l = this.C; i < l; i++) {\n ci = this.belongings[i];\n\n if (!(ci in newLabels)) {\n newLabels[ci] = C;\n inducedGraph[C] = {\n inAdj: {},\n outAdj: {},\n totalInWeights: this.totalInWeights[ci],\n totalOutWeights: this.totalOutWeights[ci],\n internalWeights: 0\n };\n C++;\n }\n\n // We do this to otpimize the number of lookups in next loop\n this.belongings[i] = newLabels[ci];\n }\n\n // Actualizing dendrogram\n var currentLevel, nextLevel;\n\n if (this.keepDendrogram) {\n currentLevel = this.dendrogram[this.level];\n nextLevel = new (typed.getPointerArray(C))(N);\n\n for (i = 0; i < N; i++) nextLevel[i] = this.belongings[currentLevel[i]];\n\n this.dendrogram.push(nextLevel);\n } else {\n for (i = 0; i < N; i++) this.mapping[i] = this.belongings[this.mapping[i]];\n }\n\n // Building induced graph matrix\n for (i = 0, l = this.C; i < l; i++) {\n ci = this.belongings[i];\n offset = this.offsets[i];\n\n data = inducedGraph[ci];\n inAdj = data.inAdj;\n outAdj = data.outAdj;\n data.internalWeights += this.loops[i];\n\n for (j = this.starts[i], m = this.starts[i + 1]; j < m; j++) {\n n = this.neighborhood[j];\n cj = this.belongings[n];\n out = j < offset;\n\n adj = out ? outAdj : inAdj;\n\n if (ci === cj) {\n if (out) data.internalWeights += this.weights[j];\n\n continue;\n }\n\n if (!(cj in adj)) adj[cj] = 0;\n\n adj[cj] += this.weights[j];\n }\n }\n\n // Rewriting neighborhood\n this.C = C;\n\n n = 0;\n\n for (ci = 0; ci < C; ci++) {\n data = inducedGraph[ci];\n inAdj = data.inAdj;\n outAdj = data.outAdj;\n\n ci = +ci;\n\n this.totalInWeights[ci] = data.totalInWeights;\n this.totalOutWeights[ci] = data.totalOutWeights;\n this.loops[ci] = data.internalWeights;\n this.counts[ci] = 1;\n\n this.starts[ci] = n;\n this.belongings[ci] = ci;\n\n for (cj in outAdj) {\n this.neighborhood[n] = +cj;\n this.weights[n] = outAdj[cj];\n\n E++;\n n++;\n }\n\n this.offsets[ci] = n;\n\n for (cj in inAdj) {\n this.neighborhood[n] = +cj;\n this.weights[n] = inAdj[cj];\n\n E++;\n n++;\n }\n }\n\n this.starts[C] = E;\n\n this.E = E;\n this.U = 0;\n this.level++;\n\n return newLabels;\n};\n\nDirectedLouvainIndex.prototype.modularity = function () {\n var ci, cj, i, j, m;\n\n var Q = 0;\n var M = this.M;\n var internalWeights = new Float64Array(this.C);\n\n for (i = 0; i < this.C; i++) {\n ci = this.belongings[i];\n internalWeights[ci] += this.loops[i];\n\n for (j = this.starts[i], m = this.offsets[i]; j < m; j++) {\n cj = this.belongings[this.neighborhood[j]];\n\n if (ci !== cj) continue;\n\n internalWeights[ci] += this.weights[j];\n }\n }\n\n for (i = 0; i < this.C; i++)\n Q +=\n internalWeights[i] / M -\n ((this.totalInWeights[i] * this.totalOutWeights[i]) / Math.pow(M, 2)) *\n this.resolution;\n\n return Q;\n};\n\nDirectedLouvainIndex.prototype.delta = function (\n i,\n inDegree,\n outDegree,\n targetCommunityDegree,\n targetCommunity\n) {\n var M = this.M;\n\n var targetCommunityTotalInWeight = this.totalInWeights[targetCommunity],\n targetCommunityTotalOutWeight = this.totalOutWeights[targetCommunity];\n\n var loops = this.loops[i];\n\n inDegree += loops;\n outDegree += loops;\n\n return (\n targetCommunityDegree / M -\n ((outDegree * targetCommunityTotalInWeight +\n inDegree * targetCommunityTotalOutWeight) *\n this.resolution) /\n (M * M)\n );\n};\n\nDirectedLouvainIndex.prototype.deltaWithOwnCommunity = function (\n i,\n inDegree,\n outDegree,\n targetCommunityDegree,\n targetCommunity\n) {\n var M = this.M;\n\n var targetCommunityTotalInWeight = this.totalInWeights[targetCommunity],\n targetCommunityTotalOutWeight = this.totalOutWeights[targetCommunity];\n\n var loops = this.loops[i];\n\n inDegree += loops;\n outDegree += loops;\n\n return (\n targetCommunityDegree / M -\n ((outDegree * (targetCommunityTotalInWeight - inDegree) +\n inDegree * (targetCommunityTotalOutWeight - outDegree)) *\n this.resolution) /\n (M * M)\n );\n};\n\nDirectedLouvainIndex.prototype.collect =\n UndirectedLouvainIndex.prototype.collect;\nDirectedLouvainIndex.prototype.assign = UndirectedLouvainIndex.prototype.assign;\n\nDirectedLouvainIndex.prototype[INSPECT] = function () {\n var proxy = {};\n\n // Trick so that node displays the name of the constructor\n Object.defineProperty(proxy, 'constructor', {\n value: DirectedLouvainIndex,\n enumerable: false\n });\n\n proxy.C = this.C;\n proxy.M = this.M;\n proxy.E = this.E;\n proxy.U = this.U;\n proxy.resolution = this.resolution;\n proxy.level = this.level;\n proxy.nodes = this.nodes;\n proxy.starts = this.starts.slice(0, proxy.C + 1);\n\n var eTruncated = ['neighborhood', 'weights'];\n var cTruncated = [\n 'counts',\n 'offsets',\n 'loops',\n 'belongings',\n 'totalInWeights',\n 'totalOutWeights'\n ];\n\n var self = this;\n\n eTruncated.forEach(function (key) {\n proxy[key] = self[key].slice(0, proxy.E);\n });\n\n cTruncated.forEach(function (key) {\n proxy[key] = self[key].slice(0, proxy.C);\n });\n\n proxy.unused = this.unused.slice(0, this.U);\n\n if (this.keepDendrogram) proxy.dendrogram = this.dendrogram;\n else proxy.mapping = this.mapping;\n\n return proxy;\n};\n\nexports.UndirectedLouvainIndex = UndirectedLouvainIndex;\nexports.DirectedLouvainIndex = DirectedLouvainIndex;\n","/**\n * Graphology Louvain Algorithm\n * =============================\n *\n * JavaScript implementation of the famous Louvain community detection\n * algorithm for graphology.\n *\n * [Articles]\n * M. E. J. Newman, « Modularity and community structure in networks »,\n * Proc. Natl. Acad. Sci. USA, vol. 103, no 23, 2006, p. 8577–8582\n * https://dx.doi.org/10.1073%2Fpnas.0601602103\n *\n * Newman, M. E. J. « Community detection in networks: Modularity optimization\n * and maximum likelihood are equivalent ». Physical Review E, vol. 94, no 5,\n * novembre 2016, p. 052315. arXiv.org, doi:10.1103/PhysRevE.94.052315.\n * https://arxiv.org/pdf/1606.02319.pdf\n *\n * Blondel, Vincent D., et al. « Fast unfolding of communities in large\n * networks ». Journal of Statistical Mechanics: Theory and Experiment,\n * vol. 2008, no 10, octobre 2008, p. P10008. DOI.org (Crossref),\n * doi:10.1088/1742-5468/2008/10/P10008.\n * https://arxiv.org/pdf/0803.0476.pdf\n *\n * Nicolas Dugué, Anthony Perez. Directed Louvain: maximizing modularity in\n * directed networks. [Research Report] Université d’Orléans. 2015. hal-01231784\n * https://hal.archives-ouvertes.fr/hal-01231784\n *\n * R. Lambiotte, J.-C. Delvenne and M. Barahona. Laplacian Dynamics and\n * Multiscale Modular Structure in Networks,\n * doi:10.1109/TNSE.2015.2391998.\n * https://arxiv.org/abs/0812.1770\n *\n * Traag, V. A., et al. « From Louvain to Leiden: Guaranteeing Well-Connected\n * Communities ». Scientific Reports, vol. 9, no 1, décembre 2019, p. 5233.\n * DOI.org (Crossref), doi:10.1038/s41598-019-41695-z.\n * https://arxiv.org/abs/1810.08473\n */\nvar resolveDefaults = require('graphology-utils/defaults');\nvar isGraph = require('graphology-utils/is-graph');\nvar inferType = require('graphology-utils/infer-type');\nvar SparseMap = require('mnemonist/sparse-map');\nvar SparseQueueSet = require('mnemonist/sparse-queue-set');\nvar createRandomIndex = require('pandemonium/random-index').createRandomIndex;\n\nvar indices = require('graphology-indices/louvain');\n\nvar UndirectedLouvainIndex = indices.UndirectedLouvainIndex;\nvar DirectedLouvainIndex = indices.DirectedLouvainIndex;\n\nvar DEFAULTS = {\n nodeCommunityAttribute: 'community',\n getEdgeWeight: 'weight',\n fastLocalMoves: true,\n randomWalk: true,\n resolution: 1,\n rng: Math.random\n};\n\nfunction addWeightToCommunity(map, community, weight) {\n var currentWeight = map.get(community);\n\n if (typeof currentWeight === 'undefined') currentWeight = 0;\n\n currentWeight += weight;\n\n map.set(community, currentWeight);\n}\n\nvar EPSILON = 1e-10;\n\nfunction tieBreaker(\n bestCommunity,\n currentCommunity,\n targetCommunity,\n delta,\n bestDelta\n) {\n if (Math.abs(delta - bestDelta) < EPSILON) {\n if (bestCommunity === currentCommunity) {\n return false;\n } else {\n return targetCommunity > bestCommunity;\n }\n } else if (delta > bestDelta) {\n return true;\n }\n\n return false;\n}\n\nfunction undirectedLouvain(detailed, graph, options) {\n var index = new UndirectedLouvainIndex(graph, {\n getEdgeWeight: options.getEdgeWeight,\n keepDendrogram: detailed,\n resolution: options.resolution\n });\n\n var randomIndex = createRandomIndex(options.rng);\n\n // State variables\n var moveWasMade = true,\n localMoveWasMade = true;\n\n // Communities\n var currentCommunity, targetCommunity;\n var communities = new SparseMap(Float64Array, index.C);\n\n // Traversal\n var queue, start, end, weight, ci, ri, s, i, j, l;\n\n // Metrics\n var degree, targetCommunityDegree;\n\n // Moves\n var bestCommunity, bestDelta, deltaIsBetter, delta;\n\n // Details\n var deltaComputations = 0,\n nodesVisited = 0,\n moves = [],\n localMoves,\n currentMoves;\n\n if (options.fastLocalMoves) queue = new SparseQueueSet(index.C);\n\n while (moveWasMade) {\n l = index.C;\n\n moveWasMade = false;\n localMoveWasMade = true;\n\n if (options.fastLocalMoves) {\n currentMoves = 0;\n\n // Traversal of the graph\n ri = options.randomWalk ? randomIndex(l) : 0;\n\n for (s = 0; s < l; s++, ri++) {\n i = ri % l;\n queue.enqueue(i);\n }\n\n while (queue.size !== 0) {\n i = queue.dequeue();\n nodesVisited++;\n\n degree = 0;\n communities.clear();\n\n currentCommunity = index.belongings[i];\n\n start = index.starts[i];\n end = index.starts[i + 1];\n\n // Traversing neighbors\n for (; start < end; start++) {\n j = index.neighborhood[start];\n weight = index.weights[start];\n\n targetCommunity = index.belongings[j];\n\n // Incrementing metrics\n degree += weight;\n addWeightToCommunity(communities, targetCommunity, weight);\n }\n\n // Finding best community to move to\n bestDelta = index.fastDeltaWithOwnCommunity(\n i,\n degree,\n communities.get(currentCommunity) || 0,\n currentCommunity\n );\n bestCommunity = currentCommunity;\n\n for (ci = 0; ci < communities.size; ci++) {\n targetCommunity = communities.dense[ci];\n\n if (targetCommunity === currentCommunity) continue;\n\n targetCommunityDegree = communities.vals[ci];\n\n deltaComputations++;\n\n delta = index.fastDelta(\n i,\n degree,\n targetCommunityDegree,\n targetCommunity\n );\n\n deltaIsBetter = tieBreaker(\n bestCommunity,\n currentCommunity,\n targetCommunity,\n delta,\n bestDelta\n );\n\n if (deltaIsBetter) {\n bestDelta = delta;\n bestCommunity = targetCommunity;\n }\n }\n\n // Should we move the node?\n if (bestDelta < 0) {\n // NOTE: this is to allow nodes to move back to their own singleton\n // This code however only deals with modularity (e.g. the condition\n // about bestDelta < 0, which is the delta for moving back to\n // singleton wrt. modularity). Indeed, rarely, the Louvain\n // algorithm can produce such cases when a node would be better in\n // a singleton that in its own community when considering self loops\n // or a resolution != 1. In this case, delta with your own community\n // is indeed less than 0. To handle different metrics, one should\n // consider computing the delta for going back to singleton because\n // it might not be 0.\n bestCommunity = index.isolate(i, degree);\n\n // If the node was already in a singleton community, we don't consider\n // a move was made\n if (bestCommunity === currentCommunity) continue;\n } else {\n // If no move was made, we continue to next node\n if (bestCommunity === currentCommunity) {\n continue;\n } else {\n // Actually moving the node to a new community\n index.move(i, degree, bestCommunity);\n }\n }\n\n moveWasMade = true;\n currentMoves++;\n\n // Adding neighbors from other communities to the queue\n start = index.starts[i];\n end = index.starts[i + 1];\n\n for (; start < end; start++) {\n j = index.neighborhood[start];\n targetCommunity = index.belongings[j];\n\n if (targetCommunity !== bestCommunity) queue.enqueue(j);\n }\n }\n\n moves.push(currentMoves);\n } else {\n localMoves = [];\n moves.push(localMoves);\n\n // Traditional Louvain iterative traversal of the graph\n while (localMoveWasMade) {\n localMoveWasMade = false;\n currentMoves = 0;\n\n ri = options.randomWalk ? randomIndex(l) : 0;\n\n for (s = 0; s < l; s++, ri++) {\n i = ri % l;\n\n nodesVisited++;\n\n degree = 0;\n communities.clear();\n\n currentCommunity = index.belongings[i];\n\n start = index.starts[i];\n end = index.starts[i + 1];\n\n // Traversing neighbors\n for (; start < end; start++) {\n j = index.neighborhood[start];\n weight = index.weights[start];\n\n targetCommunity = index.belongings[j];\n\n // Incrementing metrics\n degree += weight;\n addWeightToCommunity(communities, targetCommunity, weight);\n }\n\n // Finding best community to move to\n bestDelta = index.fastDeltaWithOwnCommunity(\n i,\n degree,\n communities.get(currentCommunity) || 0,\n currentCommunity\n );\n bestCommunity = currentCommunity;\n\n for (ci = 0; ci < communities.size; ci++) {\n targetCommunity = communities.dense[ci];\n\n if (targetCommunity === currentCommunity) continue;\n\n targetCommunityDegree = communities.vals[ci];\n\n deltaComputations++;\n\n delta = index.fastDelta(\n i,\n degree,\n targetCommunityDegree,\n targetCommunity\n );\n\n deltaIsBetter = tieBreaker(\n bestCommunity,\n currentCommunity,\n targetCommunity,\n delta,\n bestDelta\n );\n\n if (deltaIsBetter) {\n bestDelta = delta;\n bestCommunity = targetCommunity;\n }\n }\n\n // Should we move the node?\n if (bestDelta < 0) {\n // NOTE: this is to allow nodes to move back to their own singleton\n // This code however only deals with modularity (e.g. the condition\n // about bestDelta < 0, which is the delta for moving back to\n // singleton wrt. modularity). Indeed, rarely, the Louvain\n // algorithm can produce such cases when a node would be better in\n // a singleton that in its own community when considering self loops\n // or a resolution != 1. In this case, delta with your own community\n // is indeed less than 0. To handle different metrics, one should\n // consider computing the delta for going back to singleton because\n // it might not be 0.\n bestCommunity = index.isolate(i, degree);\n\n // If the node was already in a singleton community, we don't consider\n // a move was made\n if (bestCommunity === currentCommunity) continue;\n } else {\n // If no move was made, we continue to next node\n if (bestCommunity === currentCommunity) {\n continue;\n } else {\n // Actually moving the node to a new community\n index.move(i, degree, bestCommunity);\n }\n }\n\n localMoveWasMade = true;\n currentMoves++;\n }\n\n localMoves.push(currentMoves);\n\n moveWasMade = localMoveWasMade || moveWasMade;\n }\n }\n\n // We continue working on the induced graph\n if (moveWasMade) index.zoomOut();\n }\n\n var results = {\n index: index,\n deltaComputations: deltaComputations,\n nodesVisited: nodesVisited,\n moves: moves\n };\n\n return results;\n}\n\nfunction directedLouvain(detailed, graph, options) {\n var index = new DirectedLouvainIndex(graph, {\n getEdgeWeight: options.getEdgeWeight,\n keepDendrogram: detailed,\n resolution: options.resolution\n });\n\n var randomIndex = createRandomIndex(options.rng);\n\n // State variables\n var moveWasMade = true,\n localMoveWasMade = true;\n\n // Communities\n var currentCommunity, targetCommunity;\n var communities = new SparseMap(Float64Array, index.C);\n\n // Traversal\n var queue, start, end, offset, out, weight, ci, ri, s, i, j, l;\n\n // Metrics\n var inDegree, outDegree, targetCommunityDegree;\n\n // Moves\n var bestCommunity, bestDelta, deltaIsBetter, delta;\n\n // Details\n var deltaComputations = 0,\n nodesVisited = 0,\n moves = [],\n localMoves,\n currentMoves;\n\n if (options.fastLocalMoves) queue = new SparseQueueSet(index.C);\n\n while (moveWasMade) {\n l = index.C;\n\n moveWasMade = false;\n localMoveWasMade = true;\n\n if (options.fastLocalMoves) {\n currentMoves = 0;\n\n // Traversal of the graph\n ri = options.randomWalk ? randomIndex(l) : 0;\n\n for (s = 0; s < l; s++, ri++) {\n i = ri % l;\n queue.enqueue(i);\n }\n\n while (queue.size !== 0) {\n i = queue.dequeue();\n nodesVisited++;\n\n inDegree = 0;\n outDegree = 0;\n communities.clear();\n\n currentCommunity = index.belongings[i];\n\n start = index.starts[i];\n end = index.starts[i + 1];\n offset = index.offsets[i];\n\n // Traversing neighbors\n for (; start < end; start++) {\n out = start < offset;\n j = index.neighborhood[start];\n weight = index.weights[start];\n\n targetCommunity = index.belongings[j];\n\n // Incrementing metrics\n if (out) outDegree += weight;\n else inDegree += weight;\n\n addWeightToCommunity(communities, targetCommunity, weight);\n }\n\n // Finding best community to move to\n bestDelta = index.deltaWithOwnCommunity(\n i,\n inDegree,\n outDegree,\n communities.get(currentCommunity) || 0,\n currentCommunity\n );\n bestCommunity = currentCommunity;\n\n for (ci = 0; ci < communities.size; ci++) {\n targetCommunity = communities.dense[ci];\n\n if (targetCommunity === currentCommunity) continue;\n\n targetCommunityDegree = communities.vals[ci];\n\n deltaComputations++;\n\n delta = index.delta(\n i,\n inDegree,\n outDegree,\n targetCommunityDegree,\n targetCommunity\n );\n\n deltaIsBetter = tieBreaker(\n bestCommunity,\n currentCommunity,\n targetCommunity,\n delta,\n bestDelta\n );\n\n if (deltaIsBetter) {\n bestDelta = delta;\n bestCommunity = targetCommunity;\n }\n }\n\n // Should we move the node?\n if (bestDelta < 0) {\n // NOTE: this is to allow nodes to move back to their own singleton\n // This code however only deals with modularity (e.g. the condition\n // about bestDelta < 0, which is the delta for moving back to\n // singleton wrt. modularity). Indeed, rarely, the Louvain\n // algorithm can produce such cases when a node would be better in\n // a singleton that in its own community when considering self loops\n // or a resolution != 1. In this case, delta with your own community\n // is indeed less than 0. To handle different metrics, one should\n // consider computing the delta for going back to singleton because\n // it might not be 0.\n bestCommunity = index.isolate(i, inDegree, outDegree);\n\n // If the node was already in a singleton community, we don't consider\n // a move was made\n if (bestCommunity === currentCommunity) continue;\n } else {\n // If no move was made, we continue to next node\n if (bestCommunity === currentCommunity) {\n continue;\n } else {\n // Actually moving the node to a new community\n index.move(i, inDegree, outDegree, bestCommunity);\n }\n }\n\n moveWasMade = true;\n currentMoves++;\n\n // Adding neighbors from other communities to the queue\n start = index.starts[i];\n end = index.starts[i + 1];\n\n for (; start < end; start++) {\n j = index.neighborhood[start];\n targetCommunity = index.belongings[j];\n\n if (targetCommunity !== bestCommunity) queue.enqueue(j);\n }\n }\n\n moves.push(currentMoves);\n } else {\n localMoves = [];\n moves.push(localMoves);\n\n // Traditional Louvain iterative traversal of the graph\n while (localMoveWasMade) {\n localMoveWasMade = false;\n currentMoves = 0;\n\n ri = options.randomWalk ? randomIndex(l) : 0;\n\n for (s = 0; s < l; s++, ri++) {\n i = ri % l;\n\n nodesVisited++;\n\n inDegree = 0;\n outDegree = 0;\n communities.clear();\n\n currentCommunity = index.belongings[i];\n\n start = index.starts[i];\n end = index.starts[i + 1];\n offset = index.offsets[i];\n\n // Traversing neighbors\n for (; start < end; start++) {\n out = start < offset;\n j = index.neighborhood[start];\n weight = index.weights[start];\n\n targetCommunity = index.belongings[j];\n\n // Incrementing metrics\n if (out) outDegree += weight;\n else inDegree += weight;\n\n addWeightToCommunity(communities, targetCommunity, weight);\n }\n\n // Finding best community to move to\n bestDelta = index.deltaWithOwnCommunity(\n i,\n inDegree,\n outDegree,\n communities.get(currentCommunity) || 0,\n currentCommunity\n );\n bestCommunity = currentCommunity;\n\n for (ci = 0; ci < communities.size; ci++) {\n targetCommunity = communities.dense[ci];\n\n if (targetCommunity === currentCommunity) continue;\n\n targetCommunityDegree = communities.vals[ci];\n\n deltaComputations++;\n\n delta = index.delta(\n i,\n inDegree,\n outDegree,\n targetCommunityDegree,\n targetCommunity\n );\n\n deltaIsBetter = tieBreaker(\n bestCommunity,\n currentCommunity,\n targetCommunity,\n delta,\n bestDelta\n );\n\n if (deltaIsBetter) {\n bestDelta = delta;\n bestCommunity = targetCommunity;\n }\n }\n\n // Should we move the node?\n if (bestDelta < 0) {\n // NOTE: this is to allow nodes to move back to their own singleton\n // This code however only deals with modularity (e.g. the condition\n // about bestDelta < 0, which is the delta for moving back to\n // singleton wrt. modularity). Indeed, rarely, the Louvain\n // algorithm can produce such cases when a node would be better in\n // a singleton that in its own community when considering self loops\n // or a resolution != 1. In this case, delta with your own community\n // is indeed less than 0. To handle different metrics, one should\n // consider computing the delta for going back to singleton because\n // it might not be 0.\n bestCommunity = index.isolate(i, inDegree, outDegree);\n\n // If the node was already in a singleton community, we don't consider\n // a move was made\n if (bestCommunity === currentCommunity) continue;\n } else {\n // If no move was made, we continue to next node\n if (bestCommunity === currentCommunity) {\n continue;\n } else {\n // Actually moving the node to a new community\n index.move(i, inDegree, outDegree, bestCommunity);\n }\n }\n\n localMoveWasMade = true;\n currentMoves++;\n }\n\n localMoves.push(currentMoves);\n\n moveWasMade = localMoveWasMade || moveWasMade;\n }\n }\n\n // We continue working on the induced graph\n if (moveWasMade) index.zoomOut();\n }\n\n var results = {\n index: index,\n deltaComputations: deltaComputations,\n nodesVisited: nodesVisited,\n moves: moves\n };\n\n return results;\n}\n\n/**\n * Function returning the communities mapping of the graph.\n *\n * @param {boolean} assign - Assign communities to nodes attributes?\n * @param {boolean} detailed - Whether to return detailed information.\n * @param {Graph} graph - Target graph.\n * @param {object} options - Options:\n * @param {string} nodeCommunityAttribute - Community node attribute name.\n * @param {string} getEdgeWeight - Weight edge attribute name or getter function.\n * @param {string} deltaComputation - Method to use to compute delta computations.\n * @param {boolean} fastLocalMoves - Whether to use the fast local move optimization.\n * @param {boolean} randomWalk - Whether to traverse the graph in random order.\n * @param {number} resolution - Resolution parameter.\n * @param {function} rng - RNG function to use.\n * @return {object}\n */\nfunction louvain(assign, detailed, graph, options) {\n if (!isGraph(graph))\n throw new Error(\n 'graphology-communities-louvain: the given graph is not a valid graphology instance.'\n );\n\n var type = inferType(graph);\n\n if (type === 'mixed')\n throw new Error(\n 'graphology-communities-louvain: cannot run the algorithm on a true mixed graph.'\n );\n\n // Attributes name\n options = resolveDefaults(options, DEFAULTS);\n\n // Empty graph case\n var c = 0;\n\n if (graph.size === 0) {\n if (assign) {\n graph.forEachNode(function (node) {\n graph.setNodeAttribute(node, options.nodeCommunityAttribute, c++);\n });\n\n return;\n }\n\n var communities = {};\n\n graph.forEachNode(function (node) {\n communities[node] = c++;\n });\n\n if (!detailed) return communities;\n\n return {\n communities: communities,\n count: graph.order,\n deltaComputations: 0,\n dendrogram: null,\n level: 0,\n modularity: NaN,\n moves: null,\n nodesVisited: 0,\n resolution: options.resolution\n };\n }\n\n var fn = type === 'undirected' ? undirectedLouvain : directedLouvain;\n\n var results = fn(detailed, graph, options);\n\n var index = results.index;\n\n // Standard output\n if (!detailed) {\n if (assign) {\n index.assign(options.nodeCommunityAttribute);\n return;\n }\n\n return index.collect();\n }\n\n // Detailed output\n var output = {\n count: index.C,\n deltaComputations: results.deltaComputations,\n dendrogram: index.dendrogram,\n level: index.level,\n modularity: index.modularity(),\n moves: results.moves,\n nodesVisited: results.nodesVisited,\n resolution: options.resolution\n };\n\n if (assign) {\n index.assign(options.nodeCommunityAttribute);\n return output;\n }\n\n output.communities = index.collect();\n\n return output;\n}\n\n/**\n * Exporting.\n */\nvar fn = louvain.bind(null, false, false);\nfn.assign = louvain.bind(null, true, false);\nfn.detailed = louvain.bind(null, false, true);\nfn.defaults = DEFAULTS;\n\nmodule.exports = fn;\n","/*\n * Copyright 2026 OpenTrace Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport { UndirectedGraph } from 'graphology';\nimport louvain from 'graphology-communities-louvain';\nimport type {\n GraphNode,\n GraphLink,\n CommunityData,\n LayoutConfig,\n} from './types';\n\n/**\n * Compute Louvain communities on the full (unfiltered) graph.\n * Color and naming functions are provided via layoutConfig to avoid\n * coupling to a specific color palette.\n */\nexport function useCommunities(\n allNodes: GraphNode[],\n allLinks: GraphLink[],\n layoutConfig: LayoutConfig,\n): CommunityData {\n return useMemo(() => {\n if (allNodes.length === 0) {\n return {\n assignments: {} as Record<string, number>,\n colorMap: new Map<number, string>(),\n names: new Map<number, string>(),\n count: 0,\n };\n }\n\n const tempGraph = new UndirectedGraph();\n const nodeIdSet = new Set<string>();\n\n for (const node of allNodes) {\n if (!nodeIdSet.has(node.id)) {\n tempGraph.addNode(node.id);\n nodeIdSet.add(node.id);\n }\n }\n\n for (const link of allLinks) {\n const source =\n typeof link.source === 'string'\n ? link.source\n : (link.source as GraphNode).id;\n const target =\n typeof link.target === 'string'\n ? link.target\n : (link.target as GraphNode).id;\n if (source === target) continue;\n if (!nodeIdSet.has(source) || !nodeIdSet.has(target)) continue;\n\n if (tempGraph.hasEdge(source, target)) {\n const w =\n (tempGraph.getEdgeAttribute(source, target, 'weight') as number) ?? 1;\n tempGraph.setEdgeAttribute(source, target, 'weight', w + 1);\n } else {\n tempGraph.addEdge(source, target, { weight: 1 });\n }\n }\n\n const assignments = louvain(tempGraph, {\n resolution: layoutConfig.louvainResolution,\n getEdgeWeight: 'weight',\n });\n const colorMap = layoutConfig.buildCommunityColorMap(assignments);\n const names = layoutConfig.buildCommunityNames(assignments, allNodes);\n const count = new Set(Object.values(assignments)).size;\n\n if (process.env.NODE_ENV === 'development') {\n console.log(\n `[graph] Louvain: ${count} communities from ${allNodes.length} nodes`,\n );\n }\n\n return { assignments, colorMap, names, count };\n }, [allNodes, allLinks, layoutConfig]);\n}\n","/*\n * Copyright 2026 OpenTrace Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport type Graph from 'graphology';\nimport type { GraphNode, GraphLink, FilterState } from './types';\n\n/** Extract a string ID from a link endpoint (handles string, number, and object forms). */\nfunction endpointId(endpoint: string | number | GraphNode | undefined): string {\n if (typeof endpoint === 'string') return endpoint;\n if (typeof endpoint === 'object' && endpoint !== null)\n return (endpoint as GraphNode).id;\n return String(endpoint);\n}\n\n/**\n * Compute highlight sets (nodes, links, labels) and a hop-distance map based on\n * the current search query, selected node, hop depth, and filter state.\n *\n * Adjacency is built from `allLinks` filtered by `filterState.hiddenLinkTypes`\n * and excluding links whose endpoints belong to hidden node types.\n */\nexport function useHighlights(\n _graph: Graph,\n _layoutReady: boolean,\n allNodes: GraphNode[],\n allLinks: GraphLink[],\n searchQuery: string,\n selectedNodeId: string | null,\n hops: number,\n filterState: FilterState,\n): {\n highlightNodes: Set<string>;\n highlightLinks: Set<string>;\n labelNodes: Set<string>;\n hopMap: Map<string, number>;\n} {\n // Build a node-type lookup so we can filter out hidden endpoint types.\n const nodeTypeMap = useMemo(() => {\n const map = new Map<string, string>();\n for (const node of allNodes) {\n map.set(node.id, node.type);\n }\n return map;\n }, [allNodes]);\n\n // Build adjacency from allLinks, respecting filter state.\n const adjacency = useMemo(() => {\n const map = new Map<string, { neighbor: string; linkKey: string }[]>();\n for (const link of allLinks) {\n // Skip hidden link types.\n if (filterState.hiddenLinkTypes.has(link.label)) continue;\n\n const sourceId = endpointId(link.source);\n const targetId = endpointId(link.target);\n\n // Skip links where either endpoint is a hidden node type.\n const sourceType = nodeTypeMap.get(sourceId);\n const targetType = nodeTypeMap.get(targetId);\n if (sourceType && filterState.hiddenNodeTypes.has(sourceType)) continue;\n if (targetType && filterState.hiddenNodeTypes.has(targetType)) continue;\n\n const linkKey = `${sourceId}-${targetId}`;\n if (!map.has(sourceId)) map.set(sourceId, []);\n if (!map.has(targetId)) map.set(targetId, []);\n map.get(sourceId)!.push({ neighbor: targetId, linkKey });\n map.get(targetId)!.push({ neighbor: sourceId, linkKey });\n }\n return map;\n }, [\n allLinks,\n filterState.hiddenLinkTypes,\n filterState.hiddenNodeTypes,\n nodeTypeMap,\n ]);\n\n // Compute highlights via search and/or BFS from selected node.\n return useMemo(() => {\n const highlightNodes = new Set<string>();\n const highlightLinks = new Set<string>();\n const labelNodes = new Set<string>();\n const hopMap = new Map<string, number>();\n\n // Search: find nodes whose name, id, or type contain the query.\n if (searchQuery) {\n const q = searchQuery.toLowerCase();\n for (const node of allNodes) {\n if (\n node.name?.toLowerCase().includes(q) ||\n node.id.toLowerCase().includes(q) ||\n node.type.toLowerCase().includes(q)\n ) {\n highlightNodes.add(node.id);\n labelNodes.add(node.id);\n }\n }\n }\n\n // BFS from selected node up to `hops` depth for highlights,\n // but only up to min(2, hops) for labels.\n if (selectedNodeId) {\n const labelDepth = Math.min(2, hops);\n highlightNodes.add(selectedNodeId);\n labelNodes.add(selectedNodeId);\n hopMap.set(selectedNodeId, 0);\n let frontier = new Set<string>([selectedNodeId]);\n for (let depth = 0; depth < hops && frontier.size > 0; depth++) {\n const nextFrontier = new Set<string>();\n frontier.forEach((nodeId) => {\n const edges = adjacency.get(nodeId);\n if (!edges) return;\n edges.forEach(({ neighbor, linkKey }) => {\n highlightLinks.add(linkKey);\n if (!highlightNodes.has(neighbor)) {\n nextFrontier.add(neighbor);\n hopMap.set(neighbor, depth + 1);\n }\n highlightNodes.add(neighbor);\n if (depth < labelDepth) {\n labelNodes.add(neighbor);\n }\n });\n });\n frontier = nextFrontier;\n }\n }\n\n return { highlightNodes, highlightLinks, labelNodes, hopMap };\n }, [allNodes, searchQuery, selectedNodeId, hops, adjacency]);\n}\n"],"names":["ReflectApply","ReflectOwnKeys","NumberIsNaN","eventsModule","events","once","Graph","iterator","t","EventEmitter","isGraph","PALETTE","KNOWN","djb2","useEffect","defaults","require$$0","inferType","exports","require$$1","require$$2","DEFAULTS","louvain","require$$3","require$$4","require$$5","require$$6","assign","fn","useMemo"],"mappings":";;;;;;;;;;AAuBA,MAA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