数据结构之图- 图的表示方法(6)

本文探讨了图数据结构的组成,包括顶点和边,并分析了为什么Java Collections API未包含图的实现。介绍了图的类型,如无连接图、有向无环图、加权图等,以及图的两种常见表示方式:邻接矩阵和邻接列表。邻接矩阵通过二维数组表示,邻接列表则是一个数组或列表的列表,每个列表表示一个顶点的相邻顶点。
摘要由CSDN通过智能技术生成

Graphs is composed by vertices and edges. We can look at Internet as a graph, which webpage are vertices and hyperlinks are edges.


Why doesn't the Java Collections API include a Graph implementation?

I don’t know why there is no graph library within the JDK , but I guess Sun decided to leave this to developers, since most applications that require graphs also require very unique implementations.  Also as graphs can have so many different forms and flavours with wildly different characteristics, a general Graph might not turn out to be very useful. But we can use Graph libraries like:JGraphT

0 Graph Types

1) Unconnected graph and connected graph(非连通图和连通图)


2) undirected graph and directed graph(无向图和有向图)

3) graph with cycles and graph without cycles(有环图和无环图)

graph with cycles:  a path that ends up where it started. Like the following figure, the path B-C-D-B forms a cycle. (Notice that A-B-C-A is not a cycle because you can’t go from C to A.). 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值