图是一种抽象数据结构,本质和树结构是一样的. 图与树相比较,图具有封闭性,可以把树结构看成是图结构的前生.在树结构中,如果把兄弟节点之间或子节点之间横向连接,便构建成一个图. 树适合描述从上向下的一对多的数据结构,如公司的组织结构. 图适合描述更复杂的多对多数据结构,如复杂的群体社交关系. 1. 图理论 借助计算机解决现实世界中的问题时,除了要存储现实世界中的信息,还需要正确地描述信息之间的关系. 如在开发地图程序时,需要在计算机中正确模拟出城市与城市.或城市中各道路之间的关系图.在此基础上,才…