Skip to content

Instantly share code, notes, and snippets.

View sfcgeorge's full-sized avatar
🦔

Simon George sfcgeorge

🦔
View GitHub Profile
# This is the original algorithm with some renaming for clarity.
# DFS recursive function returns true if a matching for a_index is possible
def mcbm_can_match(graph, a_index, matches, seen):
# Try every resource one by one
for r_index in range(len(graph[0])):
# If resource at r_index can do assignment and assignment is not seen
if graph[a_index][r_index] and seen[r_index] == False:
# Mark resource as visited
seen[r_index] = True