Data structure to represent markov chains
Hi, I'm looking to have a C++ object created. I don't feel I have enough experience to figure out how to structure the object to make retrieval quick. Here's the description and a pseudo implementation.
* MChain2DData represents a number of line segments on a coordinate plane.
* Each line segment has four coordinates startX, startY, endX,endY. In the implementation, these should be shortened to L,T,R and B.
* No two segments should have the same LTRB. That is no two segments should overlap perfectly. (no duplicates)
* Each segment should also have a pointer. This pointer could represent the line's color, the line's brightness, the thickness etc. Typically it will just be brightness but to future proof the implementation, I'd like it to be expandable. That's why it's a pointer.
* Safeguards should be in place so that using LTRB coordinates that don't exist (For example -1, dimX+10) returns the proper error.
IF IT HELPS:
The very highest X dimension I could imagine using would be 512.
The very highest Y dimension I could imagine using would be 128.
The mathematical maximum on that plane is 4294967296 segments.
I'll never ever need that many. I'd say 1024 to 4096 would be an extremely future proof maximum.
MChain2DData constructor(Xdim, Ydim)
void setVal(L,T,R,B,pointer) // creates segment if it isn't there
void deleteSeg(L,T,R,B) // deletes what's in the pointer and the location internally
// these methods should be as fast as possible.
SegAndKey getByLT(L,T) //returns all segments with this LT
SegAndKey getByRB(R,B) //returns all segments with this RB
SegAndKey getByL(L) //returns all segments with this L
SegAndKey getByR(R) //returns all segments with this R
SegAndKey getAllSegs() //returns all segments