Representations of graphs

We can choose between two standard ways to represent a graph 
as a collection of adjacency lists or as an adjacency matrix. Either way applies
to both directed and undirected graphs. Because the adjacency-list representation
provides a compact way to represent sparse graphs—those for which
less than V ^2—it is usually the method of choice. Most of the graph algorithms
presented in this book assume that an input graph is represented in adjacencylist
form. We may prefer an adjacency-matrix representation, however, when the
graph is dense—E is close to V^2—or when we need to be able to tell quickly
if there is an edge connecting two given vertices.

A potential disadvantage of the adjacency-list representation is that it provides
no quicker way to determine whether a given edge .u; / is present in the graph
than to search for in the adjacency list AdjOEu. An adjacency-matrix representation
of the graph remedies this disadvantage, but at the cost of using asymptotically
more memory.

the adjacency matrix A of an undirected graph is its own transpose: A  = AT.
In some applications, it pays to store only the entries on and above the diagonal of
the adjacency matrix, thereby cutting the memory needed to store the graph almost
in half.

时间: 2024-10-09 21:17:34

Representations of graphs的相关文章

[Algorithm] 如何正确撸<算法导论>CLRS

其实算法本身不难,第一遍可以只看伪代码和算法思路.如果想进一步理解的话,第三章那些标记法是非常重要的,就算要花费大量时间才能理解,也不要马马虎虎略过.因为以后的每一章,讲完算法就是这样的分析,精通的话,很快就读完了.你所说的证明和推导大概也都是在第三章介绍了,可以回过头再认真看几遍. 至于课后题,比较难,我只做了前几章,如果要做完需要更多时间和精力.这可以通过之后做算法题来弥补,可以去leetcode等网站找一些经典的算法题做一做,加深理解. Facebook的工程师写的攻略,介绍了用算法导论来

UVALive 6508 Permutation Graphs

Permutation Graphs Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVALive. Original ID: 650864-bit integer IO format: %lld      Java class name: Main 解题:逆序数 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long l

Grapher - Change how graphs look

[Change how graphs look] Pan and zoom the graph 工具条如下: Change the type of graph 开场的Graph Template在Menu中也可调出. 也可通过菜单进行2D.3D模型的转换. Change a graph’s background 可通过菜单Layout更新背景色. Insert shapes in a 2D graph 通过Object菜单,可添加新元素.添加对象后,双击即可进行文件编辑. Change axis

ACDream - Graphs

先上题目: Graphs Time Limit: 4000/2000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) SubmitStatus Problem Description 给出N个点,M条边,问是否存在一个连通子图,子图由原图删掉一些点和边(不删亦可),且叶子数>=4(即度为1的点) Input 多组数据,每组数据N,M(0 <= N <= 10000,0 <= M <= 20000) 接下来M

【CV】ICML2015_Unsupervised Learning of Video Representations using LSTMs

Unsupervised Learning of Video Representations using LSTMs Note here: it's a learning notes on new LSTMs architecture used as an unsupervised learning way of video representations. (More unsupervised learning related topics, you can refer to: Learnin

Calculus on Computational Graphs: Backpropagation

Calculus on Computational Graphs: Backpropagation Introduction Backpropagation is the key algorithm that makes training deep models computationally tractable. For modern neural networks, it can make training with gradient descent as much as ten milli

【CareerCup】Trees and Graphs—Q4.3

转载请注明出处:http://blog.csdn.net/ns_code/article/details/24744177     题目: Given a sorted (increasing order) array, write an algorithm to create a binary tree with minimal height.     翻译: 给定一个有序数组(递增),写程序构建一棵具有最小高度的二叉树.     思路: 要使二叉树的高度最小,则要尽量使其左右子树的节点数目相

Intel&#174; Threading Building Blocks (Intel&#174; TBB) Developer Guide 中文 Parallelizing Data Flow and Dependence Graphs并行化data flow和依赖图

https://www.threadingbuildingblocks.org/docs/help/index.htm Parallelizing Data Flow and Dependency Graphs In addition to loop parallelism, the Intel® Threading Building Blocks (Intel® TBB) library also supports graph parallelism. It's possible to cre

zabbix专题:第七章 添加图像Graphs,添加聚合图形Screens

zabbix专题:第七章 添加图像Graphs,添加展示屏Screens 对Linux有兴趣的朋友加入QQ群:476794643 在线交流 本文防盗链:http://zhang789.blog.51cto.com 本节目录大纲 添加图像Graphs 添加聚合图形Screens 添加图像Graphs 如果我们想显示多个信息到一个图表上,那必须使用zabbix自定义图表功能,比如,我 们最常用的网卡流量监控,一张流量图上会包含进/出的流量信息.一个图表的数据可以来源一台主机,也可以来源于多台主机 创