Skip to content

Instantly share code, notes, and snippets.

@manojchandrak
Created March 18, 2016 19:37
Show Gist options
  • Save manojchandrak/96b6e197ac4101f83446 to your computer and use it in GitHub Desktop.
Save manojchandrak/96b6e197ac4101f83446 to your computer and use it in GitHub Desktop.
Gender homoplily -Question 2
{"nodes": [
{"id": 1, "name": "manoj kompalli", "screen_name": "Manoj_Chandra11","gender":"male"}
,{"id": 1, "name": "nutTea Organic Bar", "screen_name": "nutTeaFoods","gender":null}
,{"id": 2, "name": "Path_2_Wellness", "screen_name": "Path_2_Wellness","gender":null}
,{"id": 3, "name": "varun reddy dodda", "screen_name": "doddavarunreddy","gender":"male"}
,{"id": 4, "name": "Pole & Line Caught", "screen_name": "poleandline","gender":"male"},
{"id": 5, "name": "Abhinav", "screen_name": "Abhinav58587037","gender":"male"},
{"id": 6, "name": "Mounika Kompalli", "screen_name": "mounika2108","gender":"female"},
{"id": 7, "name": "siddu jadhav", "screen_name": "siddujadhav","gender":"male"},
{"id": 8, "name": "Manoj Chandra", "screen_name": "manoj_chandra_k","gender":"male"},
{"id": 9, "name": "SocialInFairfax", "screen_name": "SocialInFairfax","gender":null},
{"id": 10, "name": "v lakshmi", "screen_name": "lakshmi_veena","gender":"female"},
{"id": 11, "name": "Rithika Reddy", "screen_name": "RithikaR9","gender":null},
{"id": 12, "name": "sai sathwik", "screen_name": "sathwik_sai","gender":"male"},
{"id": 13, "name": "Sumanth Nag Popuri", "screen_name": "sumanthpopuri","gender":"male"},
{"id": 14, "name": "Abhishek Polavarapu", "screen_name": "abhipolavarapu","gender":"male"},
{"id": 15, "name": "Ravi Teja", "screen_name": "raviyyaahhoo","gender":"male"},
{"id": 16, "name": "Naina Sai Tipparti", "screen_name": "9ulovesu","gender":"female"},
{"id": 17, "name": "Shivani Bimavarapu", "screen_name": "ShivaniBima","gender":"female"},
{"id": 18, "name": "dinesh kumar paladhi", "screen_name": "dineshpaladhi","gender":"male"},
{"id": 19, "name": "radhakrishna reddy s", "screen_name": "s_sama2009","gender":"male"},
{"id": 20, "name": "majetisiri", "screen_name": "majetisiri","gender":null},
{"id": 21, "name": "Yeshwanth", "screen_name": "siZHky","gender":"male"},
{"id": 22, "name": "Mohammad Waseem", "screen_name": "waseemy2jakki","gender":"male"},
{"id": 23, "name": "pranith naik", "screen_name": "pranithnaik","gender":"male"},
{"id": 24, "name": "Sudarshan Katikaneni", "screen_name": "Suddkatikaneni","gender":"male"},
{"id": 25, "name": "rohithraj", "screen_name": "rohithjakati","gender":null},
{"id": 26, "name": "Amandeep Bhabra", "screen_name": "amandeepbhabra","gender":"male"},
{"id": 27, "name": "charan cherri", "screen_name": "charan_se","gender":"male"},
{"id": 28, "name": "sai mohit", "screen_name": "2391mohit","gender":"male"},
{"id": 29, "name": "M RAVI VSNP", "screen_name": "MRVSNPARAMESH","gender":"male"},
{"id": 30, "name": "rajeshreddy", "screen_name": "VemiRajeshreddy","gender":null},
{"id": 31, "name": "teju :)", "screen_name": "tejaswy9","gender":null},
{"id": 32, "name": "Sarvesh Kumar", "screen_name": "sarveshkumar91","gender":"male"},
{"id": 33, "name": "rohithreddy", "screen_name": "adullarohith","gender":null},
{"id": 34, "name": "abhishek vn", "screen_name": "abhivudali","gender":"male"},
{"id": 35, "name": "Akshi Bansal", "screen_name": "AkshiBansal94","gender":null},
{"id": 36, "name": "Riya Singhi\u00a0", "screen_name": "RiyaSinghi9","gender":"female"},
{"id": 37, "name": "sagar patel", "screen_name": "sagarid2000","gender":"male"},
{"id": 38, "name": "priya rao", "screen_name": "priyasvsstud","gender":"female"},
{"id": 39, "name": "aditya.vadrevun", "screen_name": "aditya_vadrevu","gender":null},
{"id": 40, "name": "srujana", "screen_name": "srisrujana","gender":null},
{"id": 41, "name": "amith teja", "screen_name": "amithteja","gender":"male"},
{"id": 42, "name": "Karan Patel", "screen_name": "karanpatel06","gender":"male"},
{"id": 43, "name": "Bharadwaj Jayendra", "screen_name": "bharadwa2020","gender":"male"},
{"id": 44, "name": "vishal shankar ", "screen_name": "vishaliyer19","gender":"male"},
{"id": 45, "name": "deepak thakur", "screen_name": "deepakntaurian","gender":"male"},
{"id": 46, "name": "Abhishek vn", "screen_name": "avrockstar00","gender":"male"},
{"id": 47, "name": "Sai Sasidhar", "screen_name": "Msaisasidhar","gender":"male"},
{"id": 48, "name": "venu madhav peechara", "screen_name": "venu210891","gender":"male"},
{"id": 49, "name": "maheshwar reddy", "screen_name": "mahi646","gender":null},
{"id": 50, "name": "kushwanthi", "screen_name": "kushwanthi","gender":null},
{"id": 51, "name": "Varsha Kuchimanchi", "screen_name": "devilrao","gender":"female"},
{"id": 52, "name": "Skylar\r Lucas", "screen_name": "SkylarLucas","gender":"male"},
{"id": 53, "name": "Whole Foods Market", "screen_name": "WholeFoods","gender":null},
{"id": 54, "name": "Amarjeet Takhi", "screen_name": "mathaar","gender":"male"}],
"links": [
{"source": 1, "target": 0},{"source": 2, "target": 0},{"source": 3, "target": 0},{"source": 4, "target": 0},{"source": 5, "target": 0},{"source": 6, "target": 0},{"source": 7, "target": 0},{"source": 8, "target": 0},{"source": 9, "target": 0},{"source": 10, "target": 0},{"source": 11, "target": 0},{"source": 12, "target": 0},{"source": 13, "target": 0},{"source": 14, "target": 0},{"source": 15, "target": 0},{"source": 16, "target": 0},{"source": 17, "target": 0},{"source": 18, "target": 0},{"source": 19, "target": 0},{"source": 20, "target": 0},{"source": 21, "target": 0},{"source": 22, "target": 0},{"source": 23, "target": 0},{"source": 24, "target": 0},{"source": 25, "target": 0},{"source": 26, "target": 0},{"source": 27, "target": 0},{"source": 28, "target": 0},{"source": 29, "target": 0},{"source": 30, "target": 0},{"source": 31, "target": 0},{"source": 32, "target": 0},{"source": 33, "target": 0},{"source": 34, "target": 0},{"source": 35, "target": 0},{"source": 36, "target": 0},{"source": 37, "target": 0},{"source": 38, "target": 0},{"source": 39, "target": 0},{"source": 40, "target": 0},{"source": 41, "target": 0},{"source": 42, "target": 0},{"source": 43, "target": 0},{"source": 44, "target": 0},{"source": 45, "target": 0},{"source": 46, "target": 0},{"source": 47, "target": 0},{"source": 48, "target": 0},{"source": 49, "target": 0},{"source": 50, "target": 0},{"source": 51, "target": 0},{"source": 52, "target": 0},{"source": 53, "target": 0},{"source": 54, "target": 0},
{"source": 3, "target": 18},
{"source": 4, "target": 53},
{"source": 7, "target": 24},
{"source": 8, "target": 20},
{"source": 11, "target": 16},
{"source": 11, "target": 18},
{"source": 11, "target": 20},
{"source": 12, "target": 16},
{"source": 12, "target": 20},
{"source": 13, "target": 16},
{"source": 14, "target": 16},
{"source": 15, "target": 18},
{"source": 15, "target": 20},
{"source": 16, "target": 17},
{"source": 16, "target": 18},
{"source": 16, "target": 20},
{"source": 17, "target": 18},
{"source": 17, "target": 20},
{"source": 18, "target": 20},
{"source": 19, "target": 24},
{"source": 19, "target": 25},
{"source": 21, "target": 48},
{"source": 21, "target": 50},
{"source": 24, "target": 25},
{"source": 24, "target": 32},
{"source": 24, "target": 34},
{"source": 25, "target": 26},
{"source": 26, "target": 42},
{"source": 26, "target": 47},
{"source": 28, "target": 48},
{"source": 31, "target": 32},
{"source": 37, "target": 42},
{"source": 37, "target": 46},
{"source": 48, "target": 49},
{"source": 48, "target": 50},
{"source": 49, "target": 50}]}
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.link {
stroke: #ccc;
}
.node text {
pointer-events: none;
font: 15px sans-serif;
}
</style>
<body>
<script src="//d3js.org/d3.v3.min.js"></script>
<script>
var width = 1050,
height = 960
var color = d3.scale.category20();
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var force = d3.layout.force()
.gravity(0.05)
.distance(300)
.charge(-100)
.size([width, height]);
d3.json("follower.json", function(error, json) {
if (error) throw error;
force
.nodes(json.nodes)
.links(json.links)
.start();
var link = svg.selectAll(".link")
.data(json.links)
.enter().append("line")
.attr("class", "link")
var node = svg.selectAll(".node")
.data(json.nodes)
.enter().append("circle")
.attr("class", "node")
.attr("r", 8)
.style("fill", function (d) {
return color(d.gender);
})
.call(force.drag);
node.append("circle")
.attr("x", -8)
.attr("y", -8)
.attr("width", 16)
.attr("height", 16);
node.append("text")
.attr("dx", 12)
.attr("dy", ".35em")
.text(function(d) { return d.name });
node.append("title")
.text(function(d) { return d.name; });
force.on("tick", function() {
link.attr("x1", function(d) { return d.source.x; })
.attr("y1", function(d) { return d.source.y; })
.attr("x2", function(d) { return d.target.x; })
.attr("y2", function(d) { return d.target.y; });
node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment