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
# A naive implementation of Kosajaru's algorithm to align with | |
# Hassam Uddin's pseudocode (https://hassamuddin.com/blog/kosaraju/) | |
# Other (better) Python implementations can be found elsewhere: | |
# - https://www.geeksforgeeks.org/strongly-connected-components/ | |
# - https://rosettacode.org/wiki/Kosaraju#Python | |
s = None | |
order = [] |
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
# Compute the Lovasz, Schrijver, and Szegedy numbers for graphs. | |
# | |
# A graph with 32 vertices takes under one second, so it's not the fastest. | |
# Probably the specialized code for Lovasz number from | |
# http://dollar.biz.uiowa.edu/~sburer/pmwiki/pmwiki.php%3Fn=Main.SDPLR%3Faction=logout.html | |
# would be much faster (I haven't tried it). | |
# Copyright (c) 2013 Daniel Stahlke (dan@stahlke.org) | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy |