java - A Graph data structure with simultaneous node coordinates update -
i exploring efficient way (static) graph data structure allow me easy access node coordinates; given operations involving coordinate data needed, stored in matrix class (for instance, privided n nodes in 2d space, have nx2 matrix).
the initial idea have class node attributes (including x , y coordinates in tuple, example), class graph contain array of node objects, , matrix of coordinates of these nodes. how achieve simultaneous two-direction update of matrix entries , node coordinate entries (whenever touch node 4, 4th row of matrix changes simultaneously :: whenever touch 4th row of matrix, tuple (x, y) of node 4 changes simultaneously)? please feel free propose alternative ways of data representation. understand above may work update method, avoided?
Comments
Post a Comment