Open srkankdr opened 5 years ago
I suppose the problem may be related to the cost function that I used. I directly coppied from the documentation and I couldn't understand the usage of it.
find_path()
returns a PathInfo
object that has nodes
, edges
, costs
, total_cost
attributes, so you can access the ordered nodes with path.nodes
.
Regarding the cost function, you don't need it if you're not dynamically computing costs. You could change your code to the following:
from dijkstar import Graph, find_path
matrix = ...... (distance matrix is created here)
graph = Graph()
for i in range(size):
for j in range(size):
graph.add_edge(i, j, matrix[i][j])
path = find_path(graph, 0, 6)
path
Hello,
I have created a simple graph by using a distance matrix. Below you can find the code.
My question is, how am I able to learn the details of the founded path. There is a total cost, but I want to learn with which order of nodes I will get this cost. I want to learn the optimal order of nodes.
Thank you.