I have to find shortest path and chose BFS, but nodes are described in x,y coordinates. Input data:
3 9
1 6
2 3 8
2 5 7
First two numbers are height and width, then first number in each row describes how many points in that row and other are x coordinates of point in given row. I need to create an array with connection map. I get those numbers and push them into queues.
cin >> n >> x;
for(auto i=0;i<n;i++)
{
cin >> k;
for(auto j=0;j<k;j++)
{
cin >> a;
s[I].push(a);
}
}
In this example the first node would be point [2,3], second [3,5] third [1,6],fourth [3,7] fifth [2,8] etc.
Node gets a connection with another only if it is to its right (one way graph) and it connects to first node of each row, int this example first would connect to second, third and fifth.
edges[1]={2,3,5}
I think each node except last connects to (number of rows) nodes, her it is 3;
How can I rewrite them to get edge vector "edges" with all connections?