Skip to content

Instantly share code, notes, and snippets.

View kosaraju.py
# 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 = []
@aneksteind
aneksteind / lovasz.py
Created Aug 18, 2018 — forked from dstahlke/lovasz.py
Python code to compute the Lovasz, Schrijver, and Szegedy numbers for graphs.
View lovasz.py
# 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