I am using Python 3.8. I have below list:
[['Bangalore', 116.0], ['Mumbai', 132.0], ['Kolkata', 234.0]]
then I have created as a node & added in successors
list like this:
successors = [<__main__.Node object at 0x7f89582eb7c0>, <__main__.Node object at 0x7f89582eb790>, <__main__.Node object at 0x7f89582eb7f0>]
I have created a fringe list & adding each successor node. After than sorting it based on distance value. I am getting error - '<' not supported between instances of 'node' and 'node'
for succ_node in successors:
fringe.append(succ_node)
fringe.sort() <- Error Here
This is my node class:
class Node:
def __init__(self, parent, name, g):
self.parent = parent
self.name = name
self.g = g
What am I doing wrong?