function ScholarCrawler(parser, node_ids, nodes, edges) { this.stack = []; this.node_ids = node_ids; this.parser = parser; this.nodes = nodes; this.edges = edges; this.delay = 1000; this.max_depth = 2; this.minimum_citations = 0; }; ScholarCrawler.prototype.formatArticle = function(node) { node.label = ''; node.shape = "dot"; node.original_title = node.title; node.title = "" + node.authors + " " + node.title + ". " + node.source + ", " + node.year + "."; node.mass = node.n_citations/2 + 1; node.radius = 3*Math.pow(node.n_citations, 0.8) + 3; return node; }; ScholarCrawler.prototype.process = function(url, parent_node) { var crawler = this; this.parser.parse(url, function(children) { for(i=0; i 0) { crawler.push(child['citations_url'], child); child.color = node_queued_color; } crawler.node_ids.push(child['id']); crawler.nodes.add(child); } } if(!(parent_node === null)) { parent_node.color = visjs_options.nodes.color; crawler.nodes.update(parent_node); } }); }; ScholarCrawler.prototype.push = function(url, parent_node) { this.stack.push([url, parent_node]); }; ScholarCrawler.prototype.start = function() { if(this.stack.length > 0) { var args = this.stack.pop(); this.process.apply(this, args); } var crawler = this; setTimeout(function() { crawler.start() }, this.delay); };