简体   繁体   English

有向图转置

[英]Transpose of Directed Graph

Can anyone tell me the efficient algorithm to calculate the transpose for Directed Graph for both Adjacency List and Adjacency Matrix Representations? 谁能告诉我有效的算法,以计算邻接表和邻接矩阵表示的有向图的转置? Also, the time complexity of both the algorithms. 同样,两种算法的时间复杂度。 Thanks in advance. 提前致谢。

Iterate over all edges and reverse their direction. 遍历所有边缘并反转其方向。 O(V+E) time for adjacency list and O(V^2) time for adjacency matrix. 邻接表的O(V + E)时间和邻接矩阵的O(V ^ 2)时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM