邻接矩阵和邻接表删除有向图或无向图的一条边的算法.急用.尽量简单些就好.
问题描述:
邻接矩阵和邻接表删除有向图或无向图的一条边的算法.急用.尽量简单些就好.
答
删边i-j邻接矩阵:有向图:map[i][j] = 0;无向图:map[i][j] = map[j][i] = 0;邻接表:有向图:p = v[i] -> firstedge;pre = p;while (p && p -> data != j) {pre = p;p = p -> next;}if (p && pre == p) v[i] -> f...