First, the adjacency matrix
Adjacency matrix G [i] [j] denotes i.e. vertex i to vertex j if there is a directed edge, promising 1, 0 inaction.
Second, the adjacency list
Each number represents i-th row of the vertex to vertex i has a directed edge.
Third, the star forward
N is equivalent to a singly linked list, easy to understand.
struct edges{ int to; int w; int next; }edge[MAX_N]; int idx; int h[MAX_N]; void add_edge(int u,int v,int w) { edge[++idx].w=w; edge[idx].to=v; edge[idx].next=h[u]; h[u]=idx; }