This is a graph written completely in python. It provides an intuitive way to initialize a graph and add vertices and edges. One of the goals is to have the user do the least possible work. The library will guess and work on the user's behalf in some circumstances. For ex: the API allows an edge to be added even when the vertices have not yet been added. In this case, the vertices will be added with sensible defaults.
g = Graph()
g.add_node(GraphNode('seattle', [Edge('seattle', 'bellevue', 'dist', 10), Edge('seattle', 'lynwood', 'dist', 20)]))
g.add_node(GraphNode('austin'))
g.add_edge('bellevue', 'lynwood', 'dist', 5)
g.add_edge('bellevue', 'lynwood', 'growth', 5)
g.add_edge('lynwood', 'bellevue', 'growth', 5)
print (g)
From the top level directory type:
python -munittest discover -v tests