2016-12-05 13:49:23 +01:00
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
|
2016-12-03 19:09:39 +01:00
|
|
|
class GraphConnection():
|
2016-12-13 23:00:38 +01:00
|
|
|
def __init__(self, from_point, to_point, distance=None):
|
2016-12-05 12:09:43 +01:00
|
|
|
self.from_point = from_point
|
|
|
|
self.to_point = to_point
|
2016-12-08 18:12:07 +01:00
|
|
|
self.distance = distance if distance is not None else abs(np.linalg.norm(from_point.xy - to_point.xy))
|
2016-12-03 19:09:39 +01:00
|
|
|
|
2016-12-13 23:00:38 +01:00
|
|
|
def serialize(self):
|
|
|
|
return (self.distance, )
|