Last active
December 28, 2015 15:39
-
-
Save mahmoud/7522674 to your computer and use it in GitHub Desktop.
goddamnit cycles
This file contains 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
19 -> for cycle in nx.simple_cycles(c): | |
20 print 'found cycle, length: %s' % len(cycle) | |
21 all_cycles.append(cycle) | |
22 if len(all_cycles) % 10 == 0 and do_pdb: | |
23 import pdb;pdb.set_trace() | |
24 return all_cycles | |
(Pdb) pp cycle | |
[u'Baroque_sites_of_Lazio', | |
u'Rome', | |
u'Ancient_Rome', | |
u'Ancient_Rome_by_period', | |
u'Greco-Roman_world', | |
u'Ancient_Greece', | |
u'History_of_Greek_Antiquity_by_period', | |
u'Hellenistic_period', | |
u'Hellenistic_period_by_region', | |
u'Hellenistic_Greece', | |
u'3rd-century_BC_Greek_people', | |
u'Euclid', | |
u'Euclidean_geometry', | |
u'Euclidean_solid_geometry', | |
u'Crystallography', | |
u'Crystalline_solids', | |
u'Rocks', | |
u'Petrology', | |
u'Igneous_petrology', | |
u'Volcanology', | |
u'Volcanoes', | |
u'Volcanic_islands', | |
u'Volcanic_arc_islands', | |
u'Timor', | |
u'East_Timor', | |
u'East_Timorese_society', | |
u'Languages_of_East_Timor', | |
u'Malay_language', | |
u'Malay-speaking_countries_and_territories', | |
u'Singapore', | |
u'Singaporean_culture', | |
u'Languages_of_Singapore', | |
u'Chinese_languages_in_Singapore', | |
u'Chinese_language', | |
u'Chinese-speaking_countries_and_territories', | |
u'Republic_of_China', | |
u'Politics_of_the_Republic_of_China', | |
u'Politics_of_Taiwan', | |
u'Government_of_Taiwan', | |
u'Government_of_the_Republic_of_China', | |
u'Foreign_relations_of_Taiwan', | |
u'Wars_involving_the_Republic_of_China', | |
u'World_War_II', | |
u'Aftermath_of_World_War_II', | |
u'Cold_War', | |
u'Cold_War_organizations', | |
u'NATO', | |
u'Member_states_of_NATO', | |
u'Hungary', | |
u'Politics_of_Hungary', | |
u'Foreign_relations_of_Hungary', | |
u'Bilateral_relations_of_Hungary', | |
u'Austria\u2013Hungary_relations', | |
u'Austria-Hungary', | |
u'History_of_Austria-Hungary', | |
u'History_of_Italy', | |
u'History_of_Italy_by_theme', | |
u'Social_history_of_Italy', | |
u'Extinct_languages_of_Italy', | |
u'Languages_of_ancient_Italy', | |
u'Latino-Faliscan_languages', | |
u'Romance_languages', | |
u'Romance_peoples', | |
u'French_people', | |
u'French_diaspora', | |
u'French_diaspora_in_North_America', | |
u'French_America', | |
u'French_North_America', | |
u'Haiti', | |
u'Haitian_society', | |
u'Demographics_of_Haiti', | |
u'Languages_of_Haiti', | |
u'French_language', | |
u'French-language_culture', | |
u'French_culture', | |
u'Arts_in_France', | |
u'French_architecture', | |
u'Buildings_and_structures_in_France', | |
u'Historic_sites_in_France', | |
u'World_Heritage_Sites_in_France', | |
u'Strasbourg', | |
u'Council_of_Europe', | |
u'Member_states_of_the_Council_of_Europe', | |
u'Bulgaria', | |
u'Bulgarian_society', | |
u'Languages_of_Bulgaria', | |
u'Turkish_language', | |
u'Turkish-speaking_countries_and_territories', | |
u'Cyprus', | |
u'Cypriot_culture', | |
u'Languages_of_Cyprus', | |
u'Greek_language', | |
u'Hellenic_scripts', | |
u'Greek_alphabet', | |
u'Latin_alphabets', | |
u'Latin_alphabet', | |
u'Typography', | |
u'Digital_typography', | |
u'Character_encoding', | |
u'Collation', | |
u'Alphabets', | |
u'Latin_script', | |
u'Languages_written_in_Latin_script', | |
u'Italian_language', | |
u'Italian-speaking_countries_and_territories', | |
u'Italy', | |
u'Italian_society', | |
u'Italian_culture', | |
u'Arts_in_Italy', | |
u'Italian_design', | |
u'Italian_architecture', | |
u'Buildings_and_structures_in_Italy', | |
u'Buildings_and_structures_in_Italy_by_region', | |
u'Buildings_and_structures_in_Lazio'] |
This file contains 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
# some handy commands: | |
import networkx as nx | |
import matplotlib.pyplot as plt | |
plt.figure(figsize=(40,30)) | |
nx.draw_spring(comps[0], node_size=20, alpha=0.1, with_labels=False) | |
plt.savefig('spring_big.png') | |
plt.clf() |
This file contains 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
# Nodes: | |
[u'Vatican_City', u'History_of_Vatican_City', u'Vatican_City_society', u'History_of_the_Papacy', u'Vatican_City_people', u'Popes', u'Catholic_theology_and_doctrine', u'Roman_Catholic_bishops', u'Episcopacy_in_Roman_Catholicism', u'Holy_See'] | |
##### | |
# Cycles: | |
[[u'History_of_the_Papacy', u'Popes'], | |
[u'History_of_the_Papacy', u'Popes', u'Holy_See'], | |
[u'History_of_the_Papacy', | |
u'Popes', | |
u'Holy_See', | |
u'Vatican_City', | |
u'History_of_Vatican_City'], | |
[u'Holy_See', u'Vatican_City', u'Vatican_City_people', u'Popes'], | |
[u'Holy_See', | |
u'Vatican_City', | |
u'Vatican_City_society', | |
u'Vatican_City_people', | |
u'Popes'], | |
[u'Holy_See', u'Popes'], | |
[u'Roman_Catholic_bishops', | |
u'Popes', | |
u'Catholic_theology_and_doctrine', | |
u'Episcopacy_in_Roman_Catholicism']] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment