API Web para buscar o menor caminho entre dois vértices de um grafo.
Executar servidor:
python grafo.py
Fazer requisição:
http :8000 graph:=@content source=a destination=b
{
"source": "a",
"destination": "b",
"graph": {
"vertexes": [
{"id": "a", "name": "a"},
{"id": "b", "name": "b"}
],
"edges": [
{"id": 1, "source": "a", "destination": "b", "weight": 2},
{"id": 2, "source": "a", "destination": "b", "weight": 1}
]
}
}
{
"source": "a",
"destination": "b",
"has_path": true,
"path": [
{"id": 2, "source": "a", "destination": "b", "weight": 1}
],
"cost": 1
}