Skip to content

Instantly share code, notes, and snippets.

@ResidentMario
Last active January 22, 2016 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ResidentMario/2fcabfdc3e5a45b07edf to your computer and use it in GitHub Desktop.
Save ResidentMario/2fcabfdc3e5a45b07edf to your computer and use it in GitHub Desktop.
My 30 Most Edited Wikipedia Articles Force Graph

This is a visualization of the interconnectedness of my top 30* most edited articles on Wikipedia (I go by Resident Mario on the encyclopedia), as reported by IBM Watson's Concept Insight API service. The data is scraped from the Supercount Wikimedia Lab tool with requests and beautifulsoup, interwoven using watsongraph, and visualized using d3.js.

The techniques here could eventually be easily applied to any editor! A widget for visualizing any editor's top articles is forthcoming once watsongraph makes it to the 0.3.0 release. The data munging for this visualization can be viewed here.

* The cutoff is due to a technical limitation.

{
"nodes": [
{
"id": "Kohala",
"edits": 138
},
{
"id": "Agitprop",
"edits": 22
},
{
"id": "Hual\u0101lai",
"edits": 126
},
{
"id": "Dwarf Fortress",
"edits": 100
},
{
"id": "Asinara",
"edits": 47
},
{
"id": "List of volcanoes in the Hawaiian \u2013 Emperor seamount chain",
"edits": 98
},
{
"id": "Rumford Prize",
"edits": 77
},
{
"id": "Cobb Seamount",
"edits": 32
},
{
"id": "Mauna Kea",
"edits": 543
},
{
"id": "Types of volcanic eruptions",
"edits": 236
},
{
"id": "Jacob Little",
"edits": 74
},
{
"id": "Kick 'em Jenny",
"edits": 24
},
{
"id": "Axial Seamount",
"edits": 223
},
{
"id": "Patton Seamount",
"edits": 56
},
{
"id": "Mauna Loa",
"edits": 177
},
{
"id": "Davidson Seamount",
"edits": 84
},
{
"id": "Seamount",
"edits": 135
},
{
"id": "Mount Cleveland (Alaska)",
"edits": 178
},
{
"id": "K\u012blauea",
"edits": 176
},
{
"id": "List of largest volcanic eruptions",
"edits": 80
},
{
"id": "Evolution of Hawaiian volcanoes",
"edits": 48
},
{
"id": "Shield volcano",
"edits": 138
},
{
"id": "Rum",
"edits": 35
},
{
"id": "L\u014d\u02bbihi Seamount",
"edits": 394
},
{
"id": "Military history of the Russian Empire",
"edits": 121
},
{
"id": "Hawaii hotspot",
"edits": 603
},
{
"id": "Ferdinandea",
"edits": 46
},
{
"id": "Sangay",
"edits": 73
},
{
"id": "Single parent",
"edits": 31
},
{
"id": "List of military engagements of World War I",
"edits": 36
}
],
"graph": [
[
"name",
"compose( , )"
]
],
"directed": false,
"links": [
{
"weight": 0.9630199,
"source": 0,
"target": 18
},
{
"weight": 0.88814336,
"source": 0,
"target": 8
},
{
"weight": 0.8448782,
"source": 0,
"target": 23
},
{
"weight": 0.9091792,
"source": 0,
"target": 5
},
{
"weight": 0.6702186,
"source": 0,
"target": 21
},
{
"weight": 0.9259549,
"source": 0,
"target": 14
},
{
"weight": 0.8731056,
"source": 16,
"target": 17
},
{
"weight": 0.9945524,
"source": 16,
"target": 23
},
{
"weight": 0.91211593,
"source": 16,
"target": 8
},
{
"weight": 0.9943062,
"source": 16,
"target": 7
},
{
"weight": 0.9278246,
"source": 16,
"target": 14
},
{
"weight": 0.9955419,
"source": 16,
"target": 11
},
{
"weight": 0.91751677,
"source": 16,
"target": 2
},
{
"weight": 0.941284,
"source": 16,
"target": 9
},
{
"weight": 0.9906672,
"source": 16,
"target": 25
},
{
"weight": 0.95513016,
"source": 16,
"target": 18
},
{
"weight": 0.9241858,
"source": 16,
"target": 19
},
{
"weight": 0.99460757,
"source": 16,
"target": 26
},
{
"weight": 0.9943894,
"source": 16,
"target": 20
},
{
"weight": 0.8474803,
"source": 16,
"target": 27
},
{
"weight": 0.9956464,
"source": 16,
"target": 12
},
{
"weight": 0.9959949,
"source": 16,
"target": 13
},
{
"weight": 0.943905,
"source": 16,
"target": 21
},
{
"weight": 0.9968042,
"source": 16,
"target": 5
},
{
"weight": 0.9970645,
"source": 16,
"target": 15
},
{
"weight": 0.8591498,
"source": 7,
"target": 17
},
{
"weight": 0.9741198,
"source": 7,
"target": 23
},
{
"weight": 0.8820508,
"source": 7,
"target": 8
},
{
"weight": 0.90479666,
"source": 7,
"target": 14
},
{
"weight": 0.9626523,
"source": 7,
"target": 11
},
{
"weight": 0.9243472,
"source": 7,
"target": 2
},
{
"weight": 0.92548484,
"source": 7,
"target": 9
},
{
"weight": 0.977494,
"source": 7,
"target": 25
},
{
"weight": 0.9369322,
"source": 7,
"target": 18
},
{
"weight": 0.90915644,
"source": 7,
"target": 19
},
{
"weight": 0.95568573,
"source": 7,
"target": 26
},
{
"weight": 0.98734707,
"source": 7,
"target": 20
},
{
"weight": 0.72830653,
"source": 7,
"target": 27
},
{
"weight": 0.9992444,
"source": 7,
"target": 12
},
{
"weight": 0.99919623,
"source": 7,
"target": 13
},
{
"weight": 0.93493086,
"source": 7,
"target": 21
},
{
"weight": 0.9933519,
"source": 7,
"target": 5
},
{
"weight": 0.9908343,
"source": 7,
"target": 15
},
{
"weight": 0.9127517,
"source": 11,
"target": 17
},
{
"weight": 0.97826725,
"source": 11,
"target": 23
},
{
"weight": 0.6745609,
"source": 11,
"target": 8
},
{
"weight": 0.7958324,
"source": 11,
"target": 14
},
{
"weight": 0.63792026,
"source": 11,
"target": 2
},
{
"weight": 0.9142884,
"source": 11,
"target": 9
},
{
"weight": 0.91309756,
"source": 11,
"target": 25
},
{
"weight": 0.90608037,
"source": 11,
"target": 18
},
{
"weight": 0.80687857,
"source": 11,
"target": 19
},
{
"weight": 0.9958774,
"source": 11,
"target": 26
},
{
"weight": 0.9271311,
"source": 11,
"target": 20
},
{
"weight": 0.9351117,
"source": 11,
"target": 27
},
{
"weight": 0.98484033,
"source": 11,
"target": 12
},
{
"weight": 0.9670014,
"source": 11,
"target": 13
},
{
"weight": 0.8310727,
"source": 11,
"target": 21
},
{
"weight": 0.97086686,
"source": 11,
"target": 5
},
{
"weight": 0.99002314,
"source": 11,
"target": 15
},
{
"weight": 0.99258244,
"source": 18,
"target": 23
},
{
"weight": 0.96992874,
"source": 18,
"target": 8
},
{
"weight": 0.961142,
"source": 18,
"target": 17
},
{
"weight": 0.99569553,
"source": 18,
"target": 25
},
{
"weight": 0.99365413,
"source": 18,
"target": 14
},
{
"weight": 0.96513915,
"source": 18,
"target": 9
},
{
"weight": 0.91919637,
"source": 18,
"target": 26
},
{
"weight": 0.995712,
"source": 18,
"target": 2
},
{
"weight": 0.9701853,
"source": 18,
"target": 19
},
{
"weight": 0.9959939,
"source": 18,
"target": 20
},
{
"weight": 0.8559758,
"source": 18,
"target": 27
},
{
"weight": 0.96814495,
"source": 18,
"target": 12
},
{
"weight": 0.9109492,
"source": 18,
"target": 13
},
{
"weight": 0.9818873,
"source": 18,
"target": 21
},
{
"weight": 0.9923192,
"source": 18,
"target": 5
},
{
"weight": 0.96147704,
"source": 18,
"target": 15
},
{
"weight": 0.93021417,
"source": 2,
"target": 17
},
{
"weight": 0.9740861,
"source": 2,
"target": 23
},
{
"weight": 0.97518355,
"source": 2,
"target": 8
},
{
"weight": 0.9949242,
"source": 2,
"target": 14
},
{
"weight": 0.9022217,
"source": 2,
"target": 9
},
{
"weight": 0.98765624,
"source": 2,
"target": 25
},
{
"weight": 0.89723915,
"source": 2,
"target": 19
},
{
"weight": 0.8349354,
"source": 2,
"target": 26
},
{
"weight": 0.99656755,
"source": 2,
"target": 20
},
{
"weight": 0.8134471,
"source": 2,
"target": 27
},
{
"weight": 0.9496773,
"source": 2,
"target": 12
},
{
"weight": 0.8634435,
"source": 2,
"target": 13
},
{
"weight": 0.9697945,
"source": 2,
"target": 21
},
{
"weight": 0.99372125,
"source": 2,
"target": 5
},
{
"weight": 0.9360777,
"source": 2,
"target": 15
},
{
"weight": 0.98292255,
"source": 19,
"target": 17
},
{
"weight": 0.78168374,
"source": 19,
"target": 8
},
{
"weight": 0.92182887,
"source": 19,
"target": 23
},
{
"weight": 0.93672204,
"source": 19,
"target": 27
},
{
"weight": 0.9806507,
"source": 19,
"target": 9
},
{
"weight": 0.9692918,
"source": 19,
"target": 25
},
{
"weight": 0.8780228,
"source": 19,
"target": 26
},
{
"weight": 0.9524382,
"source": 19,
"target": 20
},
{
"weight": 0.9394022,
"source": 19,
"target": 12
},
{
"weight": 0.91692126,
"source": 19,
"target": 13
},
{
"weight": 0.94833094,
"source": 19,
"target": 21
},
{
"weight": 0.9530443,
"source": 19,
"target": 5
},
{
"weight": 0.89973897,
"source": 19,
"target": 15
},
{
"weight": 0.8733276,
"source": 19,
"target": 14
},
{
"weight": 0.582982,
"source": 4,
"target": 26
},
{
"weight": 0.956849,
"source": 20,
"target": 17
},
{
"weight": 0.9973347,
"source": 20,
"target": 23
},
{
"weight": 0.99404746,
"source": 20,
"target": 8
},
{
"weight": 0.9937936,
"source": 20,
"target": 14
},
{
"weight": 0.9494085,
"source": 20,
"target": 9
},
{
"weight": 0.99809635,
"source": 20,
"target": 25
},
{
"weight": 0.9229494,
"source": 20,
"target": 26
},
{
"weight": 0.85347223,
"source": 20,
"target": 27
},
{
"weight": 0.98396313,
"source": 20,
"target": 12
},
{
"weight": 0.98959076,
"source": 20,
"target": 13
},
{
"weight": 0.9895512,
"source": 20,
"target": 21
},
{
"weight": 0.9997613,
"source": 20,
"target": 5
},
{
"weight": 0.98125875,
"source": 20,
"target": 15
},
{
"weight": 0.9523854,
"source": 21,
"target": 8
},
{
"weight": 0.9639259,
"source": 21,
"target": 17
},
{
"weight": 0.970198,
"source": 21,
"target": 14
},
{
"weight": 0.911926,
"source": 21,
"target": 9
},
{
"weight": 0.9805085,
"source": 21,
"target": 23
},
{
"weight": 0.85389215,
"source": 21,
"target": 26
},
{
"weight": 0.93305117,
"source": 21,
"target": 27
},
{
"weight": 0.957211,
"source": 21,
"target": 12
},
{
"weight": 0.9383517,
"source": 21,
"target": 13
},
{
"weight": 0.97893643,
"source": 21,
"target": 25
},
{
"weight": 0.979166,
"source": 21,
"target": 5
},
{
"weight": 0.9054211,
"source": 21,
"target": 15
},
{
"weight": 0.9210035,
"source": 5,
"target": 17
},
{
"weight": 0.98381054,
"source": 5,
"target": 8
},
{
"weight": 0.99325675,
"source": 5,
"target": 23
},
{
"weight": 0.9556757,
"source": 5,
"target": 9
},
{
"weight": 0.99656314,
"source": 5,
"target": 25
},
{
"weight": 0.9791202,
"source": 5,
"target": 26
},
{
"weight": 0.80799186,
"source": 5,
"target": 27
},
{
"weight": 0.9866204,
"source": 5,
"target": 12
},
{
"weight": 0.99079746,
"source": 5,
"target": 13
},
{
"weight": 0.98902726,
"source": 5,
"target": 14
},
{
"weight": 0.98897326,
"source": 5,
"target": 15
},
{
"weight": 0.94950235,
"source": 17,
"target": 23
},
{
"weight": 0.8929354,
"source": 17,
"target": 8
},
{
"weight": 0.9266239,
"source": 17,
"target": 14
},
{
"weight": 0.9420381,
"source": 17,
"target": 27
},
{
"weight": 0.964103,
"source": 17,
"target": 9
},
{
"weight": 0.94946146,
"source": 17,
"target": 25
},
{
"weight": 0.8908044,
"source": 17,
"target": 26
},
{
"weight": 0.91659826,
"source": 17,
"target": 12
},
{
"weight": 0.8251205,
"source": 17,
"target": 13
},
{
"weight": 0.92224073,
"source": 17,
"target": 15
},
{
"weight": 0.96058255,
"source": 8,
"target": 23
},
{
"weight": 0.67530555,
"source": 8,
"target": 27
},
{
"weight": 0.878482,
"source": 8,
"target": 9
},
{
"weight": 0.9846875,
"source": 8,
"target": 25
},
{
"weight": 0.65644306,
"source": 8,
"target": 26
},
{
"weight": 0.8694994,
"source": 8,
"target": 12
},
{
"weight": 0.8591621,
"source": 8,
"target": 13
},
{
"weight": 0.99160457,
"source": 8,
"target": 14
},
{
"weight": 0.8780543,
"source": 8,
"target": 15
},
{
"weight": 0.9953396,
"source": 23,
"target": 25
},
{
"weight": 0.99210423,
"source": 23,
"target": 14
},
{
"weight": 0.9743076,
"source": 23,
"target": 9
},
{
"weight": 0.98045313,
"source": 23,
"target": 26
},
{
"weight": 0.86075485,
"source": 23,
"target": 27
},
{
"weight": 0.9879963,
"source": 23,
"target": 12
},
{
"weight": 0.98623693,
"source": 23,
"target": 13
},
{
"weight": 0.97918177,
"source": 23,
"target": 15
},
{
"weight": 0.9171989,
"source": 9,
"target": 27
},
{
"weight": 0.9675811,
"source": 9,
"target": 25
},
{
"weight": 0.9854966,
"source": 9,
"target": 26
},
{
"weight": 0.9593001,
"source": 9,
"target": 12
},
{
"weight": 0.90970695,
"source": 9,
"target": 13
},
{
"weight": 0.9029993,
"source": 9,
"target": 14
},
{
"weight": 0.9645853,
"source": 9,
"target": 15
},
{
"weight": 0.99172795,
"source": 25,
"target": 14
},
{
"weight": 0.93803203,
"source": 25,
"target": 26
},
{
"weight": 0.8659976,
"source": 25,
"target": 27
},
{
"weight": 0.98555714,
"source": 25,
"target": 12
},
{
"weight": 0.9878937,
"source": 25,
"target": 13
},
{
"weight": 0.97143424,
"source": 25,
"target": 15
},
{
"weight": 0.80505013,
"source": 26,
"target": 14
},
{
"weight": 0.8218385,
"source": 26,
"target": 27
},
{
"weight": 0.973732,
"source": 26,
"target": 12
},
{
"weight": 0.9789999,
"source": 26,
"target": 13
},
{
"weight": 0.9804687,
"source": 26,
"target": 15
},
{
"weight": 0.7803158,
"source": 27,
"target": 14
},
{
"weight": 0.865961,
"source": 27,
"target": 12
},
{
"weight": 0.6834505,
"source": 27,
"target": 13
},
{
"weight": 0.8252049,
"source": 27,
"target": 15
},
{
"weight": 0.92612714,
"source": 12,
"target": 14
},
{
"weight": 0.9994779,
"source": 12,
"target": 13
},
{
"weight": 0.9962195,
"source": 12,
"target": 15
},
{
"weight": 0.85445243,
"source": 13,
"target": 14
},
{
"weight": 0.9964815,
"source": 13,
"target": 15
},
{
"weight": 0.8775153,
"source": 14,
"target": 15
}
],
"multigraph": false
}
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.link {
stroke: #999;
stroke-opacity: 1;
}
</style>
<script src="//d3js.org/d3.v3.js"></script>
<body>
<script>
var width = 960,
height = 500;
// var color = d3.scale.category10();
var color = "red";
var force = d3.layout.force()
.charge(-120)
.linkDistance(90)
.size([width, height]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("contributions.json", function(error, graph) {
if (error) throw error;
force
.nodes(graph.nodes)
.links(graph.links)
.start();
var scale = d3.scale.linear().domain([.5, 1]).range([1, 3]);
var color_ramp = d3.scale.linear().domain([.5,1]).range(["#ccc","#333"]);
var radius_scale = d3.scale.linear().domain([30, 610]).range([4, 20]);
var color_scale = d3.scale.linear().domain([30, 610]).range(["#ff6666", "#cc0000"]);
var link = svg.selectAll(".link")
.data(graph.links)
.enter().append("line")
.attr("class", "link")
.style("stroke-width", function(d) { return scale(d.weight); })
.style("stroke", function(d) { return color_ramp(d.weight); });
var node = svg.selectAll(".node")
.data(graph.nodes)
.enter().append("circle")
.attr("class", "node")
.attr("r", function(d) { return radius_scale(d.edits); })
.style("fill", function(d) { return color_scale(d.edits); })
.on("mouseover", function() {
d3.select(this)
.style("stroke", "#000")
})
.on("mouseout", function() {
d3.select(this)
.style("stroke", "#fff");
})
.call(force.drag);
node.append("title")
.text(function(d) { return d.id + ": " + d.edits + " edits"; });
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("cx", function(d) { return d.x; })
.attr("cy", function(d) { return d.y; });
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment