How to Build a Simple Routing Tool via NN Algorithm and Python OOP? Part 1
In this set of articles, we are going to demonstrate how to build a routing tool via NN algorithm, which allows you to add the locations with x, y coordinates, define the starting point, plan route, and plot the routes with annotations. We will cover routing part in this one and finish the demo in the next part.
Step 0: Import packages.
import math
import matplotlib.pyplot as plt
Step 1: Create Class Locations.
Initialization with instance variables x coordinate, y coordinate and loc name.
class Location:
def __init__(self, name, x, y):
self.name = name
self.x = x
self.y = y
Keep reading with a 7-day free trial
Subscribe to Informula to keep reading this post and get 7 days of free access to the full post archives.