This repository includes a lot of algorithms being useful for the UiB course INF234 Algorithms
BellmanFord.py
: Solving a distance problem with Bellman-FordBellmanFordLong.py
: Solving a distance problem with Bellman-Ford printing statesDFStime.py
: DFS including prefix orderDijkstra.py
: Solving a distance problem with DijkstraEditDistance.py
: Calculating the EditDistance between two wordsFordFulkerson.py
: Finding the flow with FordFulkersonFordFulkersonInner.py
: Finding the flow with FordFulkerson by starting at one inner stateGraphMST.py
: Solving Minimum Spanning Tree with KruskalGraphMST2.py
: Solving Minimum Spanning Tree using networkxHufman.py
: Calculates Hufman codeHufmanWithoutWord.py
: Calculates Hufman Tree without generating the codeKnapsack.py
: Solving a Knapsack problemShortestDistance.py
: Calculates the EditDistance between two stringsSubsetSum.py
: Solving a SubSet sum problem (special case of Knapsack)
python SubsetSum.py 20 3S4S5S7S11
Parameter: max weight, sequence of weights (separator: S)
Attention: List of elements doesn't work, use Knapsack
python Knapsack.py 20 3S4S5S7S11 3S4S5S7S11
python Knapsack.py 10 4S4S5S3S2S6 10S11S14S6S5S14
Parameter: max weight, sequence of weights (separator: S), sequence of values (S)
Subset sum by setting weights and values equal
Two programmes: GraphMST self programmed Kruskal
GraphMST2 is framework implementation of Prim and Kruskal
GraphMST only accepts numbers as node names
python GraphMST.py
python GraphMST2.py
Takes as input two words
Calculates control value via Levensthein framework
python EditDistance.py klinger klingre
Calculates shortest path in graph
Input path lengths in code
Does not output internal table
Long version has output
python BellmanFord.py
python BellmanFordLong.py
Shortest path without negative edges
Input path lengths in code
Argument is start node
python Dijkstra.py a
Two programmes, one for the entire algorithm and one for one iteration
Entire programme: insert edge weights in tuple orig_cap
python FordFulkerson.py
Just one iteration, three lists (third redundant, sorry)
- orig_cap: edge weights in original graph
- g_edges_used: used flow at the moment
- g_f_edges: all edges of residual graph
python FordFulkersonInner.py
insert string as argument, spaces with "_" string
Make sure the | are positioned like Pål wants them to be (like at beginning or end of word)
Second programme without words, but frequencies
python HufmannTree.py testiest_sensitiveness
python HufmanWithoutWord.py