Skip to content

Instantly share code, notes, and snippets.

View goodwin64's full-sized avatar
:octocat:

Max Donchenko goodwin64

:octocat:
View GitHub Profile
@goodwin64
goodwin64 / lab3_var3_maxflow.py
Created January 24, 2016 21:00
Non-elegant calculating the maximal flow.
class Vertex:
def __init__(self, name, value=1, connections={}):
self.name = name
self.value = value
self.connections = connections
def __repr__(self):
return "%s(%d)" % (self.name, self.value)
graph = {'A': set(['B', 'C']),
'B': set(['A', 'D', 'E']),
'C': set(['A', 'F']),
'D': set(['B']),
'E': set(['B', 'F']),
'F': set(['C', 'E'])}
def dfs_paths(graph, start, goal):
stack = [(start, [start])]
while stack: