This file contains hidden or 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
3D Printing | |
Abejas | |
Acolchado | |
Acrobacias Con Bicicletas | |
Acting | |
Actividades De La Iglesia | |
Actividades Informáticas | |
Actuacion | |
Actuar En Teatro | |
Acuarios |
This file contains hidden or 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
#include <vector> | |
#include <iostream> | |
using namespace std; | |
/** | |
\brief Given a complete, undirected, weighted graph in the form of an adjacency matrix, | |
returns the smallest tour that visits all nodes and starts and ends at the same | |
node. This dynamic programming solution runs in O(n^2 * 2^n). |
This file contains hidden or 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
class Graph: | |
def __init__(self): | |
self.nodes = set() | |
self.edges = defaultdict(list) | |
self.distances = {} | |
def add_node(self, value): | |
self.nodes.add(value) | |
def add_edge(self, from_node, to_node, distance): |