我应该创建一个算法来检索图 ADT 的边(弧)列表。
我无法访问图表私有成员。我以为我可以做类似于 DFS 或 BFS 访问标记节点的事情,如果边缘存在,将其添加到应该是算法输出的列表中,但我找不到解决方案。
我有这个方法:
bool IsEmpty()
Node InsertNode()
InsertArc(Node, Node)
DeleteNode(Node)
DeleteArc(Node, Node)
List AdjNodes(Node)
bool ExistsNode(Node)
bool ExistsArc(Node, Node)
Label ReadNode(Node)
WriteNode(Node, Label)
我可以使用什么算法?