福州五行属什么| 爸爸的奶奶叫什么| emma是什么意思| 儿童过敏性咳嗽吃什么药| 女生下面长什么样| 无的放矢什么意思| 人参和什么泡酒壮阳| 头疼按什么穴位| 天天吃玉米有什么好处和坏处| wonderflower是什么牌子| 脑梗什么东西不能吃| 蜂蜡是什么| 为什么叫211大学| 舌尖疼吃什么药| 毛发旺盛女生什么原因引起的| 黑糖和红糖有什么区别| 梦见要账是什么意思| 幽门螺杆菌是一种什么病| 9月10日是什么节日| 苏打和小苏打有什么区别| 生日送什么花合适| 股票套牢是什么意思| 送爸爸什么礼物最实用| 妊娠是什么| r表示什么| 只要睡觉就做梦是什么原因| 棱长是什么意思| 脸上长癣是什么原因造成的| 乳腺导管局限性扩张是什么意思| 杀青是什么意思| 为什么屁多是什么原因| 喉咙有痰是什么原因引起的| 私房照是什么| 梧桐树的叶子像什么| 爱无能是什么意思| 出虚恭是什么意思| 黑色记号笔用什么能擦掉| sjb是什么意思| 甲乙丙丁戊己庚辛壬癸代表什么| 小雪时节吃什么| 肚脐眼位置疼是什么原因| 脚后跟干裂用什么药膏| 六味地黄丸吃多了有什么副作用| 尿酸高注意什么| 挥霍是什么意思| 异常是什么意思| 牙齿上白色斑块是什么| 手上为什么长湿疹| 胃疼吃什么食物| 清热利湿是什么意思| 吃什么东西能养胃| 甚嚣尘上什么意思| 胃疼吃什么药管用| 6月5号是什么星座| 鼻子发痒是什么原因引起的| 世界上最可怕的动物是什么| 晚上睡不着觉是什么原因| 大豆是什么豆| 道谢是什么意思| 睡觉吐气是什么原因| 1月28日什么星座| 嘴唇为什么会干| 扇贝不能和什么一起吃| 玩得什么| 头皮发麻是什么原因| 陈五行属什么| 指背煞是什么意思| 活动是什么意思| 小肠镜什么情况下需要做| 怙恃是什么意思| 老鼠为什么不碰粘鼠板| 天成是什么意思| 鼻孔里面痒是什么原因| 每天吃一个鸡蛋有什么好处| 尿酸高多吃什么食物好| 古代广东叫什么| 贫血看什么科| 左旋肉碱什么时候吃效果好| 婴儿便便是绿色的是什么原因| 什么是电解质水| 羟基丁酸在淘宝叫什么| 什么床不能睡觉| 接吻什么感觉| mk是什么牌子| 玉米热量高为什么还减肥| TA什么意思| 舌头变肥大什么原因| 大海里面有什么| 38岁属什么| 什么叫一个周期| 女性耻骨疼是什么原因| 酒是什么味道| 大鱼际发青是什么原因| 血脂和血糖有什么区别| 4.25是什么星座| 女人什么眉毛最有福气| 交链孢霉过敏是什么| sdeer是什么牌子| 右耳痒是什么预兆| 哺乳期吃避孕药对孩子有什么影响| dmf是什么溶剂| 老保是什么意思| 午夜是什么时候| 孩子发烧手脚冰凉是什么原因| 尿培养是检查什么病| 1024是什么星座| 为什么感觉| 小孩长得慢是什么原因| 芸豆是什么| 上海月薪三万什么水平| 肌张力高有什么表现| trance什么意思| 慢性浅表性胃炎是什么意思| 为什么会得甲减| 高贵的什么| 腊肉配什么菜炒好吃| alt是什么意思| 西红柿和番茄有什么区别| picc什么意思| 锦囊妙计是什么意思| 什么是蛀牙| 八七年属什么的| 引产和流产有什么区别| 喝芝麻糊有什么好处| 农历11月18日是什么星座| 甘油三酯偏高吃什么药| 梦见炒菜是什么意思| 为什么要小心AB型血的人| 2005年是什么生肖| 灰指甲什么症状| 4月是什么星座的| 困惑什么意思| 欧阳修号什么| 张衡发明了什么| 吞服是什么意思| hobbs是什么牌子| 小孩血压高是什么原因| 周六左眼跳是什么预兆| 花开半夏什么意思| 一什么鼓| 不耐受和过敏有什么区别| 按人中有什么作用| 什么然而生| 下贱是什么意思| 查宝宝五行八字缺什么| 节育是什么意思| 唱过什么歌| lps医学上是什么意思| 打呼噜挂什么科室| 地钱是什么植物| 开庭前家属做什么准备| 城隍爷是什么神| 后背痒痒是什么原因| 强的松是什么药| 3月25是什么星座| 洪都拉斯为什么不与中国建交| 大便粗大是什么原因| 什么叫文化| 蜂王浆什么时间吃最好| 女人梦到小蛇什么预兆| 膈应是什么意思| 什么是包皮过长图片| 手足口疫苗什么时候打| 父亲节该送什么礼物| 我国最早的中医学专著是什么| 梦想成真是什么意思| 血栓是什么病| 化学阉割什么意思| 腿上有青筋是什么原因| 前列腺炎挂什么科| 便秘吃什么食物好| 重色轻友是什么意思| 丝瓜什么人不能吃| 1955属什么生肖| 感冒了吃什么水果比较好| 血管瘤是什么样子的图| 头皮癣用什么药膏最好| 乘晕宁又叫什么| 做小月子要注意什么| 神经酸是什么| 眼袋肿是什么原因| 梦见弟弟是什么意思| led是什么意思| 月经多是什么原因| 亚硝酸钠是什么东西| 手蜕皮什么原因| 小资情调是什么意思| 乙肝抗体阳性是什么意思| 肺部结节是什么原因引起的| 前胸后背疼是什么原因| 死精吃什么能调理成活精| 结合是什么意思| 什么情况下吃救心丸| 梅花是什么颜色的| 肾病什么东西不能吃| 什么叫集体户口| 腰间盘突出有什么症状| 查尿酸挂什么科| 过期的牛奶有什么用途| 搞怪是什么意思| 胃不舒服吃什么水果好| 为什么不建议小孩打流感疫苗| 梦见自己给自己剪头发是什么意思| 野合什么意思| 为什么一吃辣的就拉肚子| 什么时候可以上环最好的| 下体有异味是什么原因| 没有孕吐反应说明什么| 尿素氮是什么意思| 父亲的弟弟叫什么| 瑶柱是什么东西| 齿痕舌是什么原因| 慷他人之慨什么意思| 太阳穴凹陷是什么原因| 螃蟹苦是什么原因| 72年属什么生肖| 一什么树林| 什么的海底| 下乡插队是什么意思| 秦始皇是什么生肖| 西施姓什么| 夏天防中暑备什么药| 海棠是什么意思| 骨密度z值是什么意思| 梭形是什么形状| 10度左右穿什么衣服合适| 护士节送什么鲜花| 奔跑吧 什么时候开播| 黑裙子配什么鞋子| 区委书记属于什么级别| 小便发黄是什么原因| 什么是寓言故事| 为什么会放屁| 头疼看什么科| 胎盘厚度代表什么| 吃什么排铅最快| sly是什么牌子| 肾阴阳两虚吃什么药| 保鲜卡是什么原理纸片| 什么是特殊膳食| 32岁属什么生肖| 一什么木屋| 强痛定又叫什么| 12月26是什么星座| 夜里咳嗽是什么原因| cpu是什么意思| gmail是什么邮箱| 儿童乘坐飞机需要什么证件| 什么叫公租房| 牙龈疼是什么原因| 第一次是什么意思| 脂肪瘤挂什么科| 尿是红色的是什么原因| 脚有酸臭味是什么原因| lv中文名叫什么| 低血压是什么意思| 梅毒症状男有什么表现| 清明是什么意思| 发烧看什么科室| 脚麻看什么科室最好| 月经血量少是什么原因| 等不到天黑烟火不会太完美什么歌| 草莓什么时候成熟| 什么叫周围神经病| 百度Jump to content

• 中国使然 全球内存和SSD价格将在2018年回落

From Wikipedia, the free encyclopedia
A directed graph with three vertices (blue circles) and three edges (black arrows).
百度 中央政治局委员、中央书记处书记、中央组织部部长赵乐际审定办班方案,中央书记处书记、国务委员兼国务院秘书长、中央国家机关工委书记杨晶作出批示、提出明确要求。

In computer science, a graph is an abstract data type that is meant to implement the undirected graph and directed graph concepts from the field of graph theory within mathematics.

A graph data structure consists of a finite (and possibly mutable) set of vertices (also called nodes or points), together with a set of unordered pairs of these vertices for an undirected graph or a set of ordered pairs for a directed graph. These pairs are known as edges (also called links or lines), and for a directed graph are also known as edges but also sometimes arrows or arcs. The vertices may be part of the graph structure, or may be external entities represented by integer indices or references.

A graph data structure may also associate to each edge some edge value, such as a symbolic label or a numeric attribute (cost, capacity, length, etc.).

Operations

[edit]
UML class diagram of a Graph (abstract data type)
UML class diagram of a Graph (abstract data type)

The basic operations provided by a graph data structure G usually include:[1]

  • adjacent(G, x, y): tests whether there is an edge from the vertex x to the vertex y;
  • neighbors(G, x): lists all vertices y such that there is an edge from the vertex x to the vertex y;
  • add_vertex(G, x): adds the vertex x, if it is not there;
  • remove_vertex(G, x): removes the vertex x, if it is there;
  • add_edge(G, x, y, z): adds the edge z from the vertex x to the vertex y, if it is not there;
  • remove_edge(G, x, y): removes the edge from the vertex x to the vertex y, if it is there;
  • get_vertex_value(G, x): returns the value associated with the vertex x;
  • set_vertex_value(G, x, v): sets the value associated with the vertex x to v.

Structures that associate values to the edges usually also provide:[1]

  • get_edge_value(G, x, y): returns the value associated with the edge (x, y);
  • set_edge_value(G, x, y, v): sets the value associated with the edge (x, y) to v.

Common data structures for graph representation

[edit]
Adjacency list[2]
Vertices are stored as records or objects, and every vertex stores a list of adjacent vertices. This data structure allows the storage of additional data on the vertices. Additional data can be stored if edges are also stored as objects, in which case each vertex stores its incident edges and each edge stores its incident vertices.
Adjacency matrix[3]
A two-dimensional matrix, in which the rows represent source vertices and columns represent destination vertices. Data on edges and vertices must be stored externally. Only the cost for one edge can be stored between each pair of vertices.
Incidence matrix[4]
A two-dimensional matrix, in which the rows represent the vertices and columns represent the edges. The entries indicate the incidence relation between the vertex at a row and edge at a column.

The following table gives the time complexity cost of performing various operations on graphs, for each of these representations, with |V| the number of vertices and |E| the number of edges.[citation needed] In the matrix representations, the entries encode the cost of following an edge. The cost of edges that are not present are assumed to be ∞.

Adjacency list Adjacency matrix Incidence matrix
Store graph
Add vertex
Add edge
Remove vertex
Remove edge
Are vertices x and y adjacent (assuming that their storage positions are known)?
Remarks Slow to remove vertices and edges, because it needs to find all vertices or edges Slow to add or remove vertices, because matrix must be resized/copied Slow to add or remove vertices and edges, because matrix must be resized/copied

Adjacency lists are generally preferred for the representation of sparse graphs, while an adjacency matrix is preferred if the graph is dense; that is, the number of edges is close to the number of vertices squared, , or if one must be able to quickly look up if there is an edge connecting two vertices.[5][6]

More efficient representation of adjacency sets

[edit]

The time complexity of operations in the adjacency list representation can be improved by storing the sets of adjacent vertices in more efficient data structures, such as hash tables or balanced binary search trees (the latter representation requires that vertices are identified by elements of a linearly ordered set, such as integers or character strings). A representation of adjacent vertices via hash tables leads to an amortized average time complexity of to test adjacency of two given vertices and to remove an edge and an amortized average time complexity[7] of to remove a given vertex x of degree . The time complexity of the other operations and the asymptotic space requirement do not change.

Parallel representations

[edit]

The parallelization of graph problems faces significant challenges: Data-driven computations, unstructured problems, poor locality and high data access to computation ratio.[8][9] The graph representation used for parallel architectures plays a significant role in facing those challenges. Poorly chosen representations may unnecessarily drive up the communication cost of the algorithm, which will decrease its scalability. In the following, shared and distributed memory architectures are considered.

Shared memory

[edit]

In the case of a shared memory model, the graph representations used for parallel processing are the same as in the sequential case,[10] since parallel read-only access to the graph representation (e.g. an adjacency list) is efficient in shared memory.

Distributed memory

[edit]

In the distributed memory model, the usual approach is to partition the vertex set of the graph into sets . Here, is the amount of available processing elements (PE). The vertex set partitions are then distributed to the PEs with matching index, additionally to the corresponding edges. Every PE has its own subgraph representation, where edges with an endpoint in another partition require special attention. For standard communication interfaces like MPI, the ID of the PE owning the other endpoint has to be identifiable. During computation in a distributed graph algorithms, passing information along these edges implies communication.[10]

Partitioning the graph needs to be done carefully - there is a trade-off between low communication and even size partitioning[11] But partitioning a graph is a NP-hard problem, so it is not feasible to calculate them. Instead, the following heuristics are used.

1D partitioning: Every processor gets vertices and the corresponding outgoing edges. This can be understood as a row-wise or column-wise decomposition of the adjacency matrix. For algorithms operating on this representation, this requires an All-to-All communication step as well as message buffer sizes, as each PE potentially has outgoing edges to every other PE.[12]

2D partitioning: Every processor gets a submatrix of the adjacency matrix. Assume the processors are aligned in a rectangle , where and are the amount of processing elements in each row and column, respectively. Then each processor gets a submatrix of the adjacency matrix of dimension . This can be visualized as a checkerboard pattern in a matrix.[12] Therefore, each processing unit can only have outgoing edges to PEs in the same row and column. This bounds the amount of communication partners for each PE to out of possible ones.

Compressed representations

[edit]

Graphs with trillions of edges occur in machine learning, social network analysis, and other areas. Compressed graph representations have been developed to reduce I/O and memory requirements. General techniques such as Huffman coding are applicable, but the adjacency list or adjacency matrix can be processed in specific ways to increase efficiency.[13]

Applications of Graphs

[edit]
[edit]

Breadth-first search (BFS) and depth-first search (DFS) are two closely related approaches that are used for exploring all of the nodes in a given connected component. Both start with an arbitrary node, the "root"[14]. Strongly connected components can also be found using graph traversals using algorithms such as Kosaraju's algorithm, which is a modified DFS.

Pathfinding

[edit]

Dijkstra's Algorithm is a Pathfinding Algorithm that can be used on a positively-weighted (meaning all edge weights must be greater than or equal to 0) and/or directed graphs. This can be used to find the shortest path between two arbitrarily chosen nodes which is commonly applied in routing problems.

See also

[edit]

References

[edit]
  1. ^ a b See, e.g. Goodrich & Tamassia (2015), Section 13.1.2: Operations on graphs, p. 360. For a more detailed set of operations, see Mehlhorn, K.; N?her, S. (1999). "Chapter 6: Graphs and their data structures". LEDA: A platform for combinatorial and geometric computing (PDF). Cambridge University Press. pp. 240–282.
  2. ^ Cormen et al. (2001), pp. 528–529; Goodrich & Tamassia (2015), pp. 361-362.
  3. ^ Cormen et al. (2001), pp. 529–530; Goodrich & Tamassia (2015), p. 363.
  4. ^ Cormen et al. (2001), Exercise 22.1-7, p. 531.
  5. ^ Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein, Clifford (2001). "Section 22.1: Representations of graphs". Introduction to Algorithms (Second ed.). MIT Press and McGraw-Hill. pp. 527–531. ISBN 0-262-03293-7.
  6. ^ Goodrich, Michael T.; Tamassia, Roberto (2015). "Section 13.1: Graph terminology and representations". Algorithm Design and Applications. Wiley. pp. 355–364. ISBN 978-1-118-33591-8.
  7. ^ Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein, Clifford (2009). Introduction to Algorithms (3rd ed.). Massachusetts Institute of Technology. pp. 253–280. ISBN 978-0-262-03384-8.
  8. ^ Bader, David; Meyerhenke, Henning; Sanders, Peter; Wagner, Dorothea (January 2013). Graph Partitioning and Graph Clustering. Contemporary Mathematics. Vol. 588. American Mathematical Society. doi:10.1090/conm/588/11709. ISBN 978-0-8218-9038-7.
  9. ^ Lumsdaine, Andrew; Gregor, Douglas; Hendrickson, Bruce; Berry, Jonathan (March 2007). "Challenges in Parallel Graph Processing". Parallel Processing Letters. 17 (1): 5–20. doi:10.1142/s0129626407002843. ISSN 0129-6264.
  10. ^ a b Sanders, Peter; Mehlhorn, Kurt; Dietzfelbinger, Martin; Dementiev, Roman (2019). Sequential and Parallel Algorithms and Data Structures: The Basic Toolbox. Springer International Publishing. ISBN 978-3-030-25208-3.
  11. ^ "Parallel Processing of Graphs" (PDF). Archived from the original (PDF) on 2025-08-07. Retrieved 2025-08-07.
  12. ^ a b Bulu?, A.; Madduri, Kamesh (2011). "Applications". Parallel breadth-first search on distributed memory systems. 2011 International Conference for High Performance Computing, Networking, Storage and Analysis. CiteSeerX 10.1.1.767.5248. doi:10.1145/2063384.2063471. ISBN 978-1-4503-0771-0. S2CID 6540738.
  13. ^ Besta, Maciej; Hoefler, Torsten (27 April 2019). "Survey and Taxonomy of Lossless Graph Compression and Space-Efficient Graph Representations". arXiv:1806.01799 [cs.DS].
  14. ^ Purti (July–September 2018). "Graph Traversals and its Applications" (PDF). International Journal of Research and Analytical Reviews. 5 (3): 2.
[edit]
胸是什么 低回声结节什么意思 什么的表演 苦杏仁味是什么中毒 女人吃秋葵有什么好处
女人补铁有什么好处 场面是什么意思 大三阳转小三阳意味着什么 布施什么意思 啤酒是什么酿造的
什么快递可以寄活物 un读什么 1984年属什么 春秋是一部什么体史书 甲泼尼龙主要治什么
萘普生是什么药 新生儿什么时候吃ad 肠胃炎是什么引起的 生理期量少是什么原因 fic是什么意思
hp感染是什么意思hcv7jop9ns4r.cn 软冷冻室一般放什么东西hcv8jop6ns9r.cn 做阴超有黄体说明什么gangsutong.com 肠胃炎有什么症状hcv8jop4ns2r.cn 肝属什么hcv8jop4ns3r.cn
什么家庭养出自私冷漠hcv7jop4ns6r.cn 乾字五行属什么hcv8jop4ns5r.cn 大腿内侧发黑是什么原因hcv8jop4ns7r.cn 空调制冷效果差是什么原因hcv9jop2ns2r.cn 手一直抖是什么原因hcv7jop5ns2r.cn
夜间尿多是什么原因hcv8jop6ns6r.cn 康健是什么意思hcv8jop8ns3r.cn 胆囊壁结晶是什么意思hcv8jop3ns3r.cn vc什么意思xinmaowt.com 日加军念什么travellingsim.com
ep病毒是什么hcv8jop7ns5r.cn 诈尸是什么意思hcv8jop2ns0r.cn 三点水的字和什么有关hcv8jop7ns1r.cn 胸闷气短吃什么特效药dayuxmw.com 痔疮瘙痒用什么药hcv9jop6ns2r.cn
百度