Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Latest commit

 

History

History
55 lines (41 loc) · 890 Bytes

README.rst

File metadata and controls

55 lines (41 loc) · 890 Bytes

Grafo Curto

API Web para buscar o menor caminho entre dois vértices de um grafo.

Exemplo

Executar servidor:

python grafo.py

Fazer requisição:

http :8000 graph:=@content source=a destination=b

Requisição

{
  "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}
    ]
  }
}

Resposta

{
  "source": "a",
  "destination": "b",
  "has_path": true,
  "path": [
    {"id": 2, "source": "a", "destination": "b", "weight": 1}
  ],
  "cost": 1
}