<commit_before>Graph = function(user){
	this.user = user;
	return this;
};

Graph.prototype = {
	setData: function(data){
		this.data = data;
	},

	pruneAPIData: function(data){
		var pruned = {};
		pruned.nodes = [];
		pruned.links = [];

		//user node
		pruned.nodes.push({"name": this.user});

		for(user in data){
			pruned.nodes.push({"name": user});
			pruned.links.push({"source": 0, "target": pruned.links.length + 1, "value": data[user].score});
		}
		console.log("pruned", pruned);
		this.setData(pruned);
	},
	init: function(opts){
		var self = this;

		if(!opts){
			opts = {};
		}
		if(!opts.element){
			opts.element = "#graph";
		}

		console.log("data", this.data);
		console.log("element", opts.element);

		var width = window.innerWidth,
		height = window.innerHeight;

		var color = d3.scale.category20();

		var force = d3.layout.force()
		.charge(-400)
		.size([width, height]);
		force.linkDistance(function(link){
		return (height/2)*link.value;
		});

		force.linkStrength(function(link) {
		return link.value;
		});

		var svg = d3.select(opts.element).append("svg")
		.attr("width", width)
		.attr("height", height);

		force.nodes(this.data.nodes)
			.links(this.data.links)
			.start();

		var link = svg.selectAll(".link")
			.data(this.data.links)
			.enter().append("line")
			.attr("class", "link")
			.style("stroke-width", function(d) { return Math.sqrt(d.value); });

		var node = svg.selectAll(".node")
			.data(this.data.nodes)
			.enter().append('g')
			.call(force.drag);

		node.append("clipPath")
	    .attr("id", function(d){
	    	return "ellipse-clip" + d.index;
	    })
	  .append("ellipse")
	    .attr("cx", function(d){
	    	return 0;
	    })
	    .attr("cy", function(d){
	    	return 0;
	    })
	    .attr("rx", function(d){
	    	if(d.index == 0){
	    		d.radius = 40;
	    		return d.radius - 5;
	    	}
	    	else {
	    		d.radius = 20 * self.data.links[d.index - 1].value;
	    		return d.radius - 5;
	    	}
	    })
	    .attr("ry", function(d){
	    	if(d.index == 0){
	    		d.radius = 40;
	    		return d.radius - 5;
	    	}
	    	else {
	    		d.radius = 20 * self.data.links[d.index - 1].value;
	    		return d.radius - 5;
	    	}
	    }); 

		node.append("circle")
			.attr("r", 30)
			.attr("r", function(d){
				if(d.index == 0){
					d.radius = 40;
					return d.radius;
				}
				else {
					d.radius = 20 * self.data.links[d.index - 1].value;<commit_msg>graph updates<commit_after>Graph = function(user){
	this.user = user;
	return this;
};

Graph.prototype = {
	setData: function(data){
		this.data = data;
	},

	pruneAPIData: function(data){
		var pruned = {};
		pruned.nodes = [];
		pruned.links = [];

		//user node
		pruned.nodes.push({"name": this.user});

		for(user in data){
			pruned.nodes.push({"name": user});
			pruned.links.push({"source": 0, "target": pruned.links.length + 1, "value": data[user].score});
		}
		this.setData(pruned);
	},
	init: function(opts){
		var self = this;

		if(!opts){
			opts = {};
		}
		if(!opts.element){
			opts.element = "#graph";
		}

		var width = window.innerWidth,
		height = window.innerHeight;

		var color = d3.scale.category20();

		var force = d3.layout.force()
		.charge(-400)
		.size([width, height]);
		force.linkDistance(function(link){
		return (height/2)*link.value;
		});

		force.linkStrength(function(link) {
		return link.value;
		});

		var svg = d3.select(opts.element).append("svg")
		.attr("width", width)
		.attr("height", height);

		force.nodes(this.data.nodes)
			.links(this.data.links)
			.start();

		var link = svg.selectAll(".link")
			.data(this.data.links)
			.enter().append("line")
			.attr("class", "link")
			.style("stroke-width", function(d) { return Math.sqrt(d.value); });

		var node = svg.selectAll(".node")
			.data(this.data.nodes)
			.enter().append('g')
			.call(force.drag);

		node.append("clipPath")
	    .attr("id", function(d){
	    	return "ellipse-clip" + d.index;
	    })
	  .append("ellipse")
	    .attr("cx", function(d){
	    	return 0;
	    })
	    .attr("cy", function(d){
	    	return 0;
	    })
	    .attr("rx", function(d){
	    	if(d.index == 0){
	    		d.radius = 50;
	    		return Math.abs(d.radius - 5);
	    	}
	    	else {
	    		d.radius = 35 * self.data.links[d.index - 1].value;
	    		return Math.abs(d.radius - 5);
	    	}
	    })
	    .attr("ry", function(d){
	    	if(d.index == 0){
	    		d.radius = 50;
	    		return Math.abs(d.radius - 5);
	    	}
	    	else {
	    		d.radius = 35 * self.data.links[d.index - 1].value;
	    		return Math.abs(d.radius - 5);
	    	}
	    }); 

		node.append("circle")
			.attr("r", 30)
			.attr("r", function(d){
				if(d.index == 0){
					d.radius = 50;
					return d.radius;
				}
				else {
					d.radius = 35 * self.data.links[d.index - 1].value;
{'fraction_non_alphanumeric': 0.19828308207705192, 'fraction_numerical': 0.015494137353433836, 'mean_word_length': 2.4919590643274856, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3357605', 'n_tokens_mistral': 2150, 'n_tokens_neox': 1804, 'n_words': 318}