Skip to content

Instantly share code, notes, and snippets.

@riceissa riceissa/graph.py
Last active Sep 9, 2019

Embed
What would you like to do?
Funding chains in the x-risk/AI safety ecosystem
#!/usr/bin/env python3
# License: CC0
from graphviz import Digraph
whitelist = {
'Open Philanthropy Project': "Open Phil",
'Future of Humanity Institute': "FHI",
'Machine Intelligence Research Institute': "MIRI",
'Berkeley Existential Risk Initiative': "BERI",
'Center for Applied Rationality': "CFAR",
'Center for Human-Compatible AI': "CHAI",
'Global Catastrophic Risk Institute': "GCRI",
'Effective Altruism Grants': "EA Grants",
'Future of Life Institute': "FLI",
'Effective Altruism Funds: Long Term Future Fund': "EA Funds LTF",
'Patrick Brinich-Langlois': 'Patrick Brinich-Langlois',
'AI Safety Camp': "AI Safety Camp",
'AI summer school': "AI summer school",
'AI Impacts': "AI Impacts",
'Centre for Effective Altruism': "CEA",
'Jaan Tallinn': "Jaan Tallinn",
'Raising for Effective Giving': "REG",
'Montreal Institute for Learning Algorithms': "MILA",
'Alex Flint AI risk fund': "Alex Flint fund",
'Alliance to Feed the Earth in Disasters': "ALLFED",
'Institute for Philosophical Research': "Inst. Phil. Research",
'Thiel Foundation': "Thiel",
'EA Giving Group': "EA Giving Group",
'Centre for Effective Altruism, Oxford': "CEA",
'OpenAI': "OpenAI",
'Ought': "Ought",
'LessWrong 2.0': "LW",
'Effective Altruism Foundation Fund': "EAFF",
"Survival and Flourishing Fund": "Survival and Flourishing",
}
edges = set()
with open("dump.tsv", "r") as f:
next(f) # skip header row
for line in f:
donor, donee = line.strip().split("\t")
if donor in whitelist and donee in whitelist:
edges.add((whitelist[donor], whitelist[donee]))
# This might not be necessary, but I was worried that graphviz might not be
# able to handle arbitrary strings as node labels, so I just replace each
# string by node_N where N keeps counting up
entity_map = {}
num_entities = 0
for edge in edges:
donor, donee = edge
if donor not in entity_map:
num_entities += 1
entity_map[donor] = "node_" + str(num_entities)
if donee not in entity_map:
num_entities += 1
entity_map[donee] = "node_" + str(num_entities)
dot = Digraph(format='png')
for entity in entity_map:
dot.node(entity_map[entity], entity)
labeled_edges = []
for edge in edges:
donor, donee = edge
from_label = entity_map[donor]
to_label = entity_map[donee]
dot.edge(from_label, to_label)
print(dot.source)
dot.render("blah")
mysql donations -e "select donor,donee from donations where substring_index(cause_area,'/',1) in ('AI safety','Global catastrophic risks','Existential risks','Global catastrophic risk','X-risks','Effective altruism');" > dump.tsv
# org-based query instead of cause-area-based query
mysql donations -e "select donor,donee from donations where donor in ('AI Impacts', 'AI Safety Camp', 'AI summer school', 'Alex Flint AI risk fund', 'Alliance to Feed the Earth in Disasters', 'Berkeley Existential Risk Initiative', 'Center for Applied Rationality', 'Center for Human-Compatible AI', 'Centre for Effective Altruism', 'Centre for Effective Altruism, Oxford', 'EA Giving Group', 'Effective Altruism Foundation Fund', 'Effective Altruism Funds: Long Term Future Fund', 'Effective Altruism Grants', 'Future of Humanity Institute', 'Future of Life Institute', 'Global Catastrophic Risk Institute', 'Institute for Philosophical Research', 'Jaan Tallinn', 'LessWrong 2.0', 'Machine Intelligence Research Institute', 'Montreal Institute for Learning Algorithms', 'Open Philanthropy Project', 'OpenAI', 'Ought', 'Patrick Brinich-Langlois', 'Raising for Effective Giving', 'Survival and Flourishing Fund', 'Thiel Foundation') or donee in ('AI Impacts', 'AI Safety Camp', 'AI summer school', 'Alex Flint AI risk fund', 'Alliance to Feed the Earth in Disasters', 'Berkeley Existential Risk Initiative', 'Center for Applied Rationality', 'Center for Human-Compatible AI', 'Centre for Effective Altruism', 'Centre for Effective Altruism, Oxford', 'EA Giving Group', 'Effective Altruism Foundation Fund', 'Effective Altruism Funds: Long Term Future Fund', 'Effective Altruism Grants', 'Future of Humanity Institute', 'Future of Life Institute', 'Global Catastrophic Risk Institute', 'Institute for Philosophical Research', 'Jaan Tallinn', 'LessWrong 2.0', 'Machine Intelligence Research Institute', 'Montreal Institute for Learning Algorithms', 'Open Philanthropy Project', 'OpenAI', 'Ought', 'Patrick Brinich-Langlois', 'Raising for Effective Giving', 'Survival and Flourishing Fund', 'Thiel Foundation');" > dump.tsv
@riceissa

This comment has been minimized.

Copy link
Owner Author

commented Sep 9, 2019

Here is what the graph looks like:

blah

@riceissa

This comment has been minimized.

Copy link
Owner Author

commented Sep 9, 2019

New graph, with org-based query:

blah

@riceissa

This comment has been minimized.

Copy link
Owner Author

commented Sep 9, 2019

New graph with EA Funds fix and Patrick B-L

blah

@riceissa

This comment has been minimized.

Copy link
Owner Author

commented Sep 9, 2019

Circo:

circo

Neato:

neato

SFDP:

sfdp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.