<commit_before>NCI.socialGraph = function(socialGraphID, params){
	if (!params)
	    params = {}
	var me = $(socialGraphID);
	var force;
	var selectedDots = {};
	var socialGraphSelector = socialGraphID + " .socialGraph";
	var legendSelector = socialGraphID + " .legend";
    var activitiesListSelector = socialGraphID + " .activitiesList";

	var socialGraphID = socialGraphID.substring(1) + "_graph";
	var color = d3.scale.category10();
	var notNetworkColor = params.notNetworkColor || "#000000";
	var isClustered = params.isClustered || false ;
	var isDevided = params.isDevided || false ;
	var isFiltered = false;
	var graphWidth = params.width || me.width();
	var graphHeight =  params.height || $('#nciDetails').height() - 150;
	var radius = params.radius || function() { return 4};
	var charge = params.charge || function() { return -20};
	var linkDistance = params.linkDistance || function() { return 30};
    var communities = params.communities || null;
	var graphBuilder = communities ? new NCI.graphBuilder(communities) : undefined;
    var listBuilder = NCI.list.createListBuilder(communities);
	var numOfPoints = params.numOfPoints || 0;
	var isExpandable = params.isExpandable || false;
	var tooltip;
	var byActivities = me.find('.byactivities');
	var prettyView = me.find('.pretty');
	var showInternal = me.find('.internal');
	var experementialView = me.find('.experemential');

    var $showList = me.find('.show-list');
    var $exportList = me.find('.export-list');
    var $showGraph = me.find('.show-graph');
    var $activitiesList = me.find(".activitiesList");

	var tmpLine = undefined;
	
	byActivities.on('click', function(event){
		isDevided = this.checked;
		me.show(false, false);
	});
	prettyView.on('click', function(event){
		isClustered = this.checked;
		me.show(false, true);
	});
	showInternal.on('click', function(event){
		isFiltered = this.checked;
		me.show(false, false);
	});

	experementialView.on('click', function(event){
	    var experementialGraph = new NCI.experementialGraph();
		me.clean();
	});

    function downloadActivityList() {
        listBuilder.downloadCSV();
    }

    $exportList.on("click", downloadActivityList);

    if ($activitiesList.length > 0) {
        $showGraph.click(toggleListView);
        $showList.click(toggleListView);

        var activitiesList = d3.select(activitiesListSelector);
        listBuilder.createTable(activitiesList);
    }


    function toggleListView() {
        $showList.parent().toggleClass("hide");
        $showGraph.parent().toggleClass("hide");
        showInternal.parentsUntil("li").toggleClass("hide");

        $(socialGraphSelector).toggle("hide");
        $(legendSelector).toggle("hide");
        $(activitiesListSelector).toggle("hide");

    }

	me.show = function(needDraw, needForce){
		if (tooltip === undefined)
			tooltip = d3.select(socialGraphSelector).append("div").attr("class", "endpoint-tooltip");
		if (NCI.Communities.length == 0){
			return;
		};
		if (needDraw) {
		    d3.select("#" + socialGraphID).remove();
			if (numOfPoints > NCI.max_vertices) {
				d3.select(socialGraphSelector).append('text')
				.attr("id", socialGraphID)
				.html('Too many endpoints to draw')
				.attr('class', 'centrate');
			} else {
			    me.draw();
				NCI.GraphAppearsSound.currentTime = 0;
				NCI.GraphAppearsSound.play();	
			}
		//otherwise just change appearance	
		} else {
		    me.setupNodes();
			var sound;
			if (needForce) {
				sound = isClustered ? NCI.PrettyOn : NCI.PrettyOff;
				force.start();
			} else {
				sound =isFiltered ? NCI.ExternalOn : NCI.ExternalOff;
			}
			sound.currentTime = 0;
			sound.play();
		}
	};
	
	//colorify and set radius
	me.setupNodes = function(){
		me.node.style("fill", function(d) {
		    if ( isFiltered && NCI.isExternal(d.name)){
			    return notNetworkColor;
		    };
			//if this dot is selected on Activities graph, draw it in red<commit_msg>removed black squares, since it makes no sence<commit_after>NCI.socialGraph = function(socialGraphID, params){
	if (!params)
	    params = {}
	var me = $(socialGraphID);
	var force;
	var selectedDots = {};
	var socialGraphSelector = socialGraphID + " .socialGraph";
	var legendSelector = socialGraphID + " .legend";
    var activitiesListSelector = socialGraphID + " .activitiesList";

	var socialGraphID = socialGraphID.substring(1) + "_graph";
	var color = d3.scale.category10();
	var notNetworkColor = params.notNetworkColor || "#000000";
	var isClustered = params.isClustered || false ;
	var isDevided = params.isDevided || false ;
	var isFiltered = false;
	var graphWidth = params.width || me.width();
	var graphHeight =  params.height || $('#nciDetails').height() - 150;
	var radius = params.radius || function() { return 4};
	var charge = params.charge || function() { return -20};
	var linkDistance = params.linkDistance || function() { return 30};
    var communities = params.communities || null;
	var graphBuilder = communities ? new NCI.graphBuilder(communities) : undefined;
    var listBuilder = NCI.list.createListBuilder(communities);
	var numOfPoints = params.numOfPoints || 0;
	var isExpandable = params.isExpandable || false;
	var tooltip;
	var byActivities = me.find('.byactivities');
	var prettyView = me.find('.pretty');
	var showInternal = me.find('.internal');
	var experementialView = me.find('.experemential');

    var $showList = me.find('.show-list');
    var $exportList = me.find('.export-list');
    var $showGraph = me.find('.show-graph');
    var $activitiesList = me.find(".activitiesList");

	var tmpLine = undefined;
	
	byActivities.on('click', function(event){
		isDevided = this.checked;
		me.show(false, false);
	});
	prettyView.on('click', function(event){
		isClustered = this.checked;
		me.show(false, true);
	});
	showInternal.on('click', function(event){
		isFiltered = this.checked;
		me.show(false, false);
	});

	experementialView.on('click', function(event){
	    var experementialGraph = new NCI.experementialGraph();
		me.clean();
	});

    function downloadActivityList() {
        listBuilder.downloadCSV();
    }

    $exportList.on("click", downloadActivityList);

    if ($activitiesList.length > 0) {
        $showGraph.click(toggleListView);
        $showList.click(toggleListView);

        var activitiesList = d3.select(activitiesListSelector);
        listBuilder.createTable(activitiesList);
    }


    function toggleListView() {
        $showList.parent().toggleClass("hide");
        $showGraph.parent().toggleClass("hide");
        showInternal.parentsUntil("li").toggleClass("hide");

        $(socialGraphSelector).toggle("hide");
        $(legendSelector).toggle("hide");
        $(activitiesListSelector).toggle("hide");

    }

	me.show = function(needDraw, needForce){
		if (tooltip === undefined)
			tooltip = d3.select(socialGraphSelector).append("div").attr("class", "endpoint-tooltip");
		if (NCI.Communities.length == 0){
			return;
		};
		if (needDraw) {
		    d3.select("#" + socialGraphID).remove();
			if (numOfPoints > NCI.max_vertices) {
				d3.select(socialGraphSelector).append('text')
				.attr("id", socialGraphID)
				.html('Too many endpoints to draw')
				.attr('class', 'centrate');
			} else {
			    me.draw();
				NCI.GraphAppearsSound.currentTime = 0;
				NCI.GraphAppearsSound.play();	
			}
		//otherwise just change appearance	
		} else {
		    me.setupNodes();
			var sound;
			if (needForce) {
				sound = isClustered ? NCI.PrettyOn : NCI.PrettyOff;
				force.start();
			} else {
				sound =isFiltered ? NCI.ExternalOn : NCI.ExternalOff;
			}
			sound.currentTime = 0;
			sound.play();
		}
	};
	
	//colorify and set radius
	me.setupNodes = function(){
		me.node.style("fill", function(d) {
            // TODO: review d.size, since right now it's only way to 100% detect that this is Activity node
		    if ( isFiltered && NCI.isExternal(d.name) && d.size==undefined){
			    return notNetworkColor;
		    };
			//if this dot is selected on Activities graph, draw it in red
{'fraction_non_alphanumeric': 0.14834752128192288, 'fraction_numerical': 0.007135703555332999, 'mean_word_length': 3.721631205673759, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6437601', 'n_tokens_mistral': 2722, 'n_tokens_neox': 2463, 'n_words': 532}