ArangoDB's graph maxDepth setting causing excessive iterations

I am working on creating a substantial social network graph using ArangoDB. The database currently contains approximately 35,000 vertices connected by around 150,000 edges.

Considering the extensive amount of data, I was looking to display only a portion at a time - maybe 2 or 3 degrees away from the initial point.

However, when setting maxDepth above 1, I encounter a "1909: too many iterations" error, even with maxIterations set very low (e.g., 1).

An example query that triggers this error is:

GRAPH_TRAVERSAL('Friends', 'people/1342', 'outbound', {maxDepth: 2, maxIterations: 10})

Omitting maxIterations results in the same error.

The visualization of the graph works without issues in the web interface, indicating that the problem does not reside in the data itself. Could it be that my graph contains more data than ArangoDB can manage, or am I making an error in my approach?

Answer №1

The parameter known as maxIterations is responsible for deciding when a traversal should automatically stop after a certain number of iterations. This feature is put in place to prevent you from endlessly looping through a cyclic graph during a traversal.

It's important to note that the maxIterations does not dictate the depth of the traversal, but rather sets a limit on the number of vertices that can be visited before an error is thrown and the traversal stops.

For those wondering how to determine an appropriate maximum value for maxIterations, consider this example: Starting at a specified vertex initiates the first iteration. From there, any outgoing or ingoing connections are identified. If, for instance, there are five connections to explore from the initial vertex, you would need a minimum of 6 for maxIterations (1 for the start vertex plus 5 for the next round). If each of these 5 vertices also has 5 connections, you'd require at least 25 more iterations, bringing the total required maxIterations to 31. As you move to subsequent levels with 5 connections each, the needed iterations increase by multiples of 5.

This demonstrates that simply applying a constant increment to the maxIterations won't suffice, given the non-linear nature of the series observed (1, 6, 31, 156). The number of iterations necessary depends heavily on the data structure and connectivity between vertices.

If your goal is solely to restrict the traversal depth, utilize the minDepth or

maxDepth</code parameters while setting <code>maxIterations
to a high value unlikely to be reached due to the bounds set by maxDepth. Additional options like direction (using any yields more results at the risk of encountering cycles; opt for inbound or
outbound</code whenever possible) and <code>uniqueness
(determines how often a specific vertex or connecting edge is visited) can also help control the volume of data extracted during a traversal.

Answer №2

maxIterations serves as a limit to control the number of calculation cycles. As the size of the graph and the quantity of edges/nodes increase, more calculation cycles are required (thus requiring a higher maxIterations parameter).

Gradually increase maxIterations for maxDepth == 2 and beyond, but not too gradually - consider increments like try+1 := try*10 :-)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for managing encoding when transmitting values through ajax

When working in WordPress, I encountered an issue with an Ajax call where a value was being sent inaccurately. blow = \'blo\ Upon receiving the value on the server end, it appeared to have an extra backslash (\). blow = \\& ...

What is the best way to finish up the JavaScript code below?

Having just started learning JavaScript, I am struggling to figure out how to use JavaScript to clear the text in a text box and move it below the box when a user starts typing. I've been watching this tutorial http://codepen.io/ehermanson/pen/KwKWEv ...

What is the best way to add JSON data to a table?

I have developed a php script to create json data. However, I am facing an issue while trying to display this generated json data in a table. While my php code successfully generates the data, it is unable to insert it into the table. I would appreciate an ...

How can I implement $compile to execute a function on every row using angularjs and razor?

UPDATE: It seems that there is some confusion here, I am looking to apply the function to all rows, without using '', "", '"... After conducting some research, I have discovered that I will need to utilize $compile, but I am ...

Steps for generating instances of an HTML page and dynamically adding them to a list on the main page

I have a main HTML page and I need to insert a dynamically generated list from a template in another HTML file that I created. The template for each item in the list is located on a separate HTML page. My goal is to create multiple instances of this HTML ...

Strategies to verify if two objects of the same class possess the same attribute

I have multiple elements with the same class and unique attribute values, such as: <div class="myclass" data-attr="1"></div> <div class="myclass" data-attr="2"></div> <div class="myclass" data-attr="3"></div> <div cl ...

Need to `come back` multiple times

I am facing an issue where I want to return multiple lines, but only the first line is being returned. I attempted to create a function specifically for returning the line, but encountered errors because I couldn't figure out where to place it. Does ...

"Error encountered when attempting to upload directory due to file size

Utilizing the webkit directory to upload a folder on the server has been successful, however, an issue arises when there are more than 20 files in the folder. In this scenario, only the first 20 files get uploaded. The PHP code used for uploading the fold ...

Is it possible to have the ShowHide plugin fade in instead of toggling?

I'm currently utilizing the ShowHide Plugin and attempting to make it fade in instead of toggle/slide into view. Here's my code snippet: showHide.js (function ($) { $.fn.showHide = function (options) { //default variables for the p ...

Ajax alert: The index 'id' is not defined

I'm currently learning PHP and scripting, but I am encountering some difficulties when it comes to sending information to PHP. I would appreciate any help you can offer. Thank you for your assistance. Here is the issue at hand: Error Message: Noti ...

How to Delete Elements from an ngList Array in Angular

I encountered an issue while utilizing ngList in a text box to exchange data with my server. The problem arises when I attempt to delete items from the generated array directly, as it does not reflect the changes in the input field. The main concern is th ...

"Enhance Your Website with Dynamic Text Effects using JavaScript

Is there a way to continuously animate text during the loading process of an AJAX request? I've tried implementing various methods, such as using a setTimeout function or an infinite loop, but nothing seems to work for repeating the animation once it& ...

Working with JSON data retrieved from a PHP and MySQL backend in an AngularJS application

Having difficulty handling the JSON response from PHP. I am using AngularJs to display the received JSON data. As a newcomer to Angular, I attempted a basic exercise and would appreciate some assistance. Thank you in advance. index.html <!DOCTYPE HTML ...

How can Vue.js transfer form data values (using v-model) from a Parent component to a Child component?

I am working on a multistep form using vue.js. The parent form collects two inputs and once these are validated, it moves to the next step which involves a child component. I want to pass the values from the parent component to the child component's f ...

Enable contenteditable on table by pressing the tab key

I developed a table entry tool and I would like to be able to input items by pressing the tab key instead of having to manually click on each element. I haven't been able to figure out how to make this function work yet. $('table').on(&apos ...

How can I insert my URL into the webPDFLoader feature of LangChain platform?

I need help figuring out how to load a PDF from a URL using the webPDFLoader. Can someone explain how to implement this? Any assistance would be greatly appreciated. I am working on this task in nextjs. Where should I place the pdfUrl variable within the ...

Learning how to replace the alert function with Bootbox

I am currently working on a form that posts to a MySQL database. I want to replace the alert function triggered by the Malsup jQuery Form Plugin with the one created by the Bootbox plugin. Even though both plugins are functional, I struggle to integrate th ...

Looking to empty a textbox, give it focus, and avoid triggering an ASP.NET postback all with a single click of a

I am working on an ASP.NET project and I have a simple HTML button. When this button is clicked, my goal is to clear textbox1, set the focus on textbox1, and prevent any postback from occurring. However, I am running into an issue where preventing postba ...

Tips for declaring a non-reactive instance property in Vue.js with TypeScript

I am currently in the process of transitioning my Vue.js components to TypeScript. In accordance with the recommendations provided in the documentation, I attempted to utilize Vue.extend() for my component implementation. The code snippet for my component ...

The most efficient method for documenting $.trigger in JavaScript/jQuery is through the use of JSD

When it comes to documenting in jsDuck, what is the optimal method for capturing the following event trigger: $(document).trigger('myCustomEvent'); ...