Way of Storing Edges

Правка en1, от fofao_funk, 2016-10-11 15:43:07

Hi all.

I've came across this way of storing edges in many codes:

void addEdge(int u, int v) {
    head[edges] = v;
    prev[edges] = last[u];
    last[u] = edges++;
}

How does it work? Why is it used over the 'traditional' array of vectors?

I appreciate your help!

Теги storing edges, graph

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский fofao_funk 2016-10-11 15:43:07 316 Initial revision (published)