Created
June 19, 2012 15:17
-
-
Save joshz/2954731 to your computer and use it in GitHub Desktop.
A is not B
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import networkx as nx | |
import matplotlib.pyplot as plt | |
isnot = [('Spain', 'Greece'), | |
('Portugal', 'Greece'), | |
('Greece', 'Ireland'), | |
('Spain', 'Ireland'), | |
('Spain', 'Portugal'), | |
('Ireland', 'Greece'), | |
('Portugal', 'Ireland'), | |
('Spain', 'Uganda'), | |
('Uganda', 'Spain')] | |
flat = list(set([country for c in isnot for country in c])) | |
G = nx.Graph() | |
for c in flat: | |
G.add_node(c) | |
G.add_edges_from(isnot) | |
H = nx.DiGraph(G) | |
nx.draw(H) | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment