Skip to content

Instantly share code, notes, and snippets.

@dmgottlieb
Created July 6, 2016 21:02
Show Gist options
  • Select an option

  • Save dmgottlieb/dbe9a0ec9128d5e9fa51eae7d0d1e4cb to your computer and use it in GitHub Desktop.

Select an option

Save dmgottlieb/dbe9a0ec9128d5e9fa51eae7d0d1e4cb to your computer and use it in GitHub Desktop.
Co-cross-reference network visualization, Stanford Encyclopedia of Philosophy, top ~100 articles, Louvain community colors
{"nodes": [{"group": 2, "name": "alexander-aphrodisias"}, {"group": 2, "name": "aquinas"}, {"group": 2, "name": "aristotle"}, {"group": 2, "name": "augustine"}, {"group": 0, "name": "berkeley"}, {"group": 2, "name": "boethius"}, {"group": 5, "name": "brouwer"}, {"group": 2, "name": "buridan"}, {"group": 3, "name": "cognitive-science"}, {"group": 7, "name": "communitarianism"}, {"group": 3, "name": "compatibilism"}, {"group": 3, "name": "consciousness-intentionality"}, {"group": 3, "name": "consciousness-representational"}, {"group": 3, "name": "consciousness"}, {"group": 7, "name": "consequentialism"}, {"group": 3, "name": "content-causal"}, {"group": 3, "name": "content-externalism"}, {"group": 3, "name": "content-narrow"}, {"group": 7, "name": "democracy"}, {"group": 0, "name": "descartes"}, {"group": 5, "name": "descriptions"}, {"group": 3, "name": "determinism-causal"}, {"group": 3, "name": "dualism"}, {"group": 2, "name": "duns-scotus"}, {"group": 7, "name": "egalitarianism"}, {"group": 1, "name": "epistemology-bayesian"}, {"group": 7, "name": "equality"}, {"group": 0, "name": "existentialism"}, {"group": 3, "name": "freewill"}, {"group": 5, "name": "frege-theorem"}, {"group": 5, "name": "frege"}, {"group": 3, "name": "functionalism"}, {"group": 2, "name": "giles"}, {"group": 0, "name": "hegel"}, {"group": 0, "name": "heidegger"}, {"group": 0, "name": "hobbes"}, {"group": 0, "name": "hume"}, {"group": 0, "name": "husserl"}, {"group": 3, "name": "incompatibilism-theories"}, {"group": 3, "name": "intentionality"}, {"group": 0, "name": "james"}, {"group": 0, "name": "johann-fichte"}, {"group": 3, "name": "justep-foundational"}, {"group": 3, "name": "justep-intext"}, {"group": 7, "name": "justice-distributive"}, {"group": 0, "name": "kant"}, {"group": 0, "name": "leibniz"}, {"group": 7, "name": "liberalism"}, {"group": 7, "name": "liberty-positive-negative"}, {"group": 0, "name": "locke"}, {"group": 5, "name": "logic-classical"}, {"group": 5, "name": "logic-intuitionistic"}, {"group": 5, "name": "logic-modal"}, {"group": 5, "name": "logic-relevance"}, {"group": 5, "name": "logic-temporal"}, {"group": 0, "name": "malebranche"}, {"group": 0, "name": "marx"}, {"group": 5, "name": "mathematics-constructive"}, {"group": 2, "name": "medieval-philosophy"}, {"group": 3, "name": "mental-representation"}, {"group": 7, "name": "mill"}, {"group": 3, "name": "mind-identity"}, {"group": 5, "name": "model-theory"}, {"group": 7, "name": "moral-anti-realism"}, {"group": 7, "name": "moral-cognitivism"}, {"group": 7, "name": "moral-non-naturalism"}, {"group": 7, "name": "moral-realism"}, {"group": 3, "name": "moral-responsibility"}, {"group": 7, "name": "naturalism-moral"}, {"group": 2, "name": "neoplatonism"}, {"group": 0, "name": "newton"}, {"group": 0, "name": "nietzsche"}, {"group": 2, "name": "ockham"}, {"group": 0, "name": "peirce"}, {"group": 3, "name": "perception-contents"}, {"group": 3, "name": "perception-problem"}, {"group": 0, "name": "phenomenology"}, {"group": 3, "name": "physicalism"}, {"group": 2, "name": "plato"}, {"group": 2, "name": "plotinus"}, {"group": 1, "name": "popper"}, {"group": 5, "name": "possible-worlds"}, {"group": 1, "name": "probability-interpret"}, {"group": 2, "name": "proclus"}, {"group": 5, "name": "prop-attitude-reports"}, {"group": 5, "name": "properties"}, {"group": 1, "name": "qm-bohm"}, {"group": 1, "name": "qm"}, {"group": 1, "name": "qt-epr"}, {"group": 3, "name": "qualia"}, {"group": 5, "name": "reference"}, {"group": 5, "name": "russell"}, {"group": 0, "name": "sartre"}, {"group": 3, "name": "sense-data"}, {"group": 0, "name": "spinoza"}, {"group": 1, "name": "thomas-kuhn"}, {"group": 5, "name": "tropes"}], "links": [{"source": 0, "target": 2, "value": 13}, {"source": 1, "target": 2, "value": 17}, {"source": 1, "target": 3, "value": 19}, {"source": 1, "target": 5, "value": 12}, {"source": 1, "target": 23, "value": 20}, {"source": 1, "target": 32, "value": 12}, {"source": 1, "target": 58, "value": 13}, {"source": 1, "target": 72, "value": 16}, {"source": 1, "target": 78, "value": 11}, {"source": 2, "target": 45, "value": 14}, {"source": 2, "target": 69, "value": 12}, {"source": 2, "target": 78, "value": 43}, {"source": 2, "target": 79, "value": 19}, {"source": 2, "target": 83, "value": 12}, {"source": 4, "target": 36, "value": 12}, {"source": 4, "target": 49, "value": 14}, {"source": 6, "target": 57, "value": 11}, {"source": 7, "target": 72, "value": 17}, {"source": 8, "target": 59, "value": 11}, {"source": 9, "target": 47, "value": 11}, {"source": 10, "target": 28, "value": 12}, {"source": 11, "target": 12, "value": 12}, {"source": 12, "target": 89, "value": 11}, {"source": 13, "target": 11, "value": 12}, {"source": 13, "target": 12, "value": 11}, {"source": 13, "target": 89, "value": 13}, {"source": 14, "target": 47, "value": 11}, {"source": 14, "target": 60, "value": 13}, {"source": 15, "target": 16, "value": 13}, {"source": 16, "target": 17, "value": 15}, {"source": 18, "target": 47, "value": 15}, {"source": 19, "target": 36, "value": 14}, {"source": 19, "target": 45, "value": 19}, {"source": 19, "target": 46, "value": 28}, {"source": 19, "target": 49, "value": 15}, {"source": 19, "target": 55, "value": 15}, {"source": 19, "target": 70, "value": 14}, {"source": 19, "target": 94, "value": 15}, {"source": 20, "target": 90, "value": 11}, {"source": 21, "target": 28, "value": 12}, {"source": 22, "target": 77, "value": 16}, {"source": 23, "target": 58, "value": 13}, {"source": 23, "target": 72, "value": 17}, {"source": 24, "target": 26, "value": 11}, {"source": 24, "target": 44, "value": 12}, {"source": 25, "target": 82, "value": 13}, {"source": 26, "target": 44, "value": 15}, {"source": 27, "target": 76, "value": 15}, {"source": 27, "target": 92, "value": 11}, {"source": 28, "target": 38, "value": 14}, {"source": 28, "target": 67, "value": 11}, {"source": 30, "target": 29, "value": 11}, {"source": 30, "target": 90, "value": 12}, {"source": 30, "target": 91, "value": 25}, {"source": 31, "target": 61, "value": 11}, {"source": 31, "target": 77, "value": 13}, {"source": 31, "target": 89, "value": 11}, {"source": 33, "target": 34, "value": 12}, {"source": 33, "target": 45, "value": 26}, {"source": 33, "target": 56, "value": 16}, {"source": 33, "target": 71, "value": 11}, {"source": 34, "target": 37, "value": 16}, {"source": 34, "target": 45, "value": 13}, {"source": 34, "target": 71, "value": 13}, {"source": 34, "target": 76, "value": 16}, {"source": 35, "target": 36, "value": 11}, {"source": 35, "target": 49, "value": 18}, {"source": 36, "target": 45, "value": 21}, {"source": 36, "target": 46, "value": 12}, {"source": 36, "target": 49, "value": 16}, {"source": 37, "target": 76, "value": 22}, {"source": 39, "target": 59, "value": 14}, {"source": 40, "target": 73, "value": 11}, {"source": 41, "target": 33, "value": 11}, {"source": 41, "target": 45, "value": 12}, {"source": 42, "target": 43, "value": 12}, {"source": 45, "target": 46, "value": 23}, {"source": 45, "target": 49, "value": 11}, {"source": 45, "target": 71, "value": 12}, {"source": 45, "target": 78, "value": 16}, {"source": 45, "target": 91, "value": 12}, {"source": 45, "target": 94, "value": 13}, {"source": 46, "target": 49, "value": 12}, {"source": 46, "target": 70, "value": 11}, {"source": 46, "target": 94, "value": 17}, {"source": 47, "target": 48, "value": 11}, {"source": 47, "target": 60, "value": 15}, {"source": 50, "target": 51, "value": 16}, {"source": 50, "target": 52, "value": 21}, {"source": 50, "target": 62, "value": 11}, {"source": 50, "target": 91, "value": 11}, {"source": 51, "target": 52, "value": 11}, {"source": 51, "target": 57, "value": 12}, {"source": 52, "target": 53, "value": 12}, {"source": 52, "target": 54, "value": 11}, {"source": 52, "target": 81, "value": 12}, {"source": 58, "target": 72, "value": 14}, {"source": 61, "target": 77, "value": 11}, {"source": 64, "target": 63, "value": 13}, {"source": 64, "target": 66, "value": 11}, {"source": 65, "target": 68, "value": 13}, {"source": 69, "target": 78, "value": 11}, {"source": 74, "target": 75, "value": 12}, {"source": 75, "target": 93, "value": 11}, {"source": 76, "target": 92, "value": 12}, {"source": 77, "target": 89, "value": 14}, {"source": 78, "target": 79, "value": 17}, {"source": 79, "target": 83, "value": 12}, {"source": 84, "target": 90, "value": 11}, {"source": 85, "target": 96, "value": 16}, {"source": 87, "target": 86, "value": 12}, {"source": 87, "target": 88, "value": 11}, {"source": 90, "target": 91, "value": 12}, {"source": 95, "target": 80, "value": 11}]}
<!DOCTYPE html>
<!-- Graph code largely from D3js example, http://bl.ocks.org/mbostock/4062045, used under the GNU General Public License, version 3. -->
<!-- Pan / zoom functionality adapted from: http://bl.ocks.org/benzguo/4370043 -->
<meta charset="utf-8">
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.link {
stroke: #999;
stroke-opacity: .6;
}
.nodetext { pointer-events: none; font-size: 10px}
text {
font: 11px sans-serif;
stroke: #000;
pointer-events: none;
}
</style>
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script>
var width = 1300,
height = 700;
var color = d3.scale.category20();
// mouse event vars
var selected_node = null,
selected_link = null,
mousedown_link = null,
mousedown_node = null,
mouseup_node = null;
var force = d3.layout.force()
.charge(-125)
.linkDistance(50)
.size([width, height]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height)
.attr("pointer-events", "all");
var vis = svg
.append('svg:g')
.call(d3.behavior.zoom().on("zoom", rescale))
.on("dblclick.zoom", null)
.append('svg:g')
.on("mousedown", mousedown)
.on("mouseup", mouseup);
vis.append('svg:rect')
.attr('width', width)
.attr('height', height)
.attr('fill', 'white');
function mousedown() {
if (!mousedown_node) {
// // allow panning if nothing is selected
vis.call(d3.behavior.zoom().on("zoom", rescale));
}
}
function mouseup() {
resetMouseVars();
}
function resetMouseVars() {
mousedown_node = null;
mouseup_node = null;
mousedown_link = null;
}
// rescale g
function rescale() {
// if (!mousedown_node) {
trans=d3.event.translate;
scale=d3.event.scale;
vis.attr("transform",
"translate(" + trans + ")"
+ " scale(" + scale + ")");
// }
}
d3.json("cocitation-100.json", function(error, graph) {
if (error) throw error;
force
.nodes(graph.nodes)
.links(graph.links)
.start();
var link = vis.selectAll(".link")
.data(graph.links)
.enter().append("line")
.attr("class", "link")
.style("stroke-width", function(d) { return Math.sqrt(d.value); });
var node = vis.selectAll(".node")
.data(graph.nodes)
.enter().append("g")
.attr("class", "node")
node.append("circle")
.attr("r", 5)
.style("fill", function(d) { return color(d.group); })
.on("mousedown",
function(d) {
// disable zoom
vis.call(d3.behavior.zoom().on("zoom", null));
mousedown_node = d;
})
.on("mouseup", function(d) { vis.call(d3.behavior.zoom().on("zoom", rescale)); })
.call(force.drag);
node.append("svg:title")
.text(function(d) { return d.name; });
node.append("text")
.attr("class", "nodetext")
.attr("dx", 10)
.attr("dy", ".35em")
.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>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment