Skip to content

Dijkstra:88: attempt to index local 'e' (a number value) #4

Open
@DavidSheh

Description

@DavidSheh
local g = require('luagraphs.data.graph').create(8); -- undirected weighted graph

g:addEdge(5, 4, 72)
g:addEdge(9, 8, 73)
g:addEdge(11, 12, 66)
g:addEdge(22, 11, 48)
g:addEdge(20, 19, 34)
g:addEdge(6, 5, 56)
g:addEdge(4, 3, 76)
g:addEdge(21, 6, 18)
g:addEdge(13, 17, 47)
g:addEdge(21, 20, 37)
g:addEdge(9, 10, 61)
g:addEdge(21, 22, 102)
g:addEdge(10, 11, 65)
g:addEdge(2, 3, 85)
g:addEdge(7, 6, 82)
g:addEdge(15, 16, 43)
g:addEdge(2, 1, 74)
g:addEdge(14, 1, 48)
g:addEdge(18, 17, 71)
g:addEdge(15, 14, 47)
g:addEdge(7, 8, 71)
g:addEdge(19, 4, 121)
g:addEdge(19, 16, 61)
g:addEdge(19, 18, 64)
g:addEdge(12, 13, 24)

local source = 6
local dijkstra = require('luagraphs.shortest_paths.Dijkstra').create()
dijkstra:run(g, source) -- source is the id of the source node in the path search
local path = dijkstra:getPathTo(10)

Use the above test data to report an error。error message is :

Dijkstra:88: attempt to index local 'e' (a number value)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions