是来自b站up主同济子豪兄的中文精讲,自己做来总结给自己学习滴,如果感兴趣的话可以去b站搜索或者去子豪兄的github图神经进行学习: https://github.com/TommyZihao/zihao_course/blob/main/CS224W/1-Intro.md
Introduction | Machine Learning for Graph
1、图的基本表示
2、图的本体设计
3、图的种类(有向、无向、异质、二分、连接带权重)
4、节点连接数
5、图的基本表示 -邻接矩阵
6、图的基本表示-连接列表和邻接列表
7、图的连通性
1、图的基本表示
图是有节点(nodes or vertices)和连接(links or edges)组成
![](https://i-blog.csdnimg.cn/blog_migrate/80baefe4757d4ab9485dc7776c59b364.jpeg)
生活中的很多关系(relationship)都可以用图来表示
2、本体图(Ontology) :
节点的类型以及节点之间可能存在的连接(关系)
![](https://i-blog.csdnimg.cn/blog_migrate/4a90e89ddee18a5b8175ddb1f59dfef8.jpeg)
How to build a graph:
What are nodes?
What are edges?
关键是如何确定节点和边,你想要解决什么问题
Choice of the proper network representation of a given doman/problem determines our ability to use networks successfully:
In some cases, there is a unique, unambiguous representation
(有些时候,本体图是唯一的、无歧义的)
In other cases,the representation is by no means unique
The way you assign links will determine the nature of the question you can study.
Instance: 红楼梦知识图谱
(https://grapheco.org/InteractiveGraph/dist/examples/example1.html )
3、图的种类
![](https://i-blog.csdnimg.cn/blog_migrate/d46efe940b566e2f02b972ddd6779d7a.jpeg)
异质图(heterogeneous graph) :
![](https://i-blog.csdnimg.cn/blog_migrate/bde0105ac77ff64a035e72b357776238.jpeg)
Nodes with node types (结点种类可以不同)
Edges with relation types
Node type
Relation type
![](https://i-blog.csdnimg.cn/blog_migrate/c73d4ac2cb03e9e2198d39e04f80cf71.jpeg)
两类结点之间的关系抽象成二分图
可以展开二分图(根据关系连接)
如 U中 1、2、3都连到A,把他们连在一起
![](https://i-blog.csdnimg.cn/blog_migrate/53b3668a307a8732cd72b763941a9106.jpeg)
4、节点连接数(Node degree)
![](https://i-blog.csdnimg.cn/blog_migrate/28a93d010419032c8b78a04e550bf62d.jpeg)
Node degree 来表示结点重要度、中心度、枢纽度
Source 、Sink
in-degree(入度)、out-degree(出度)
5、图的基本表示-邻接矩阵(Adjacency Matrix)
![](https://i-blog.csdnimg.cn/blog_migrate/f5d849e004fe9170b3f7a38780538bb1.jpeg)
结点的度怎么计算(degree)
![](https://i-blog.csdnimg.cn/blog_migrate/89d56168a3c68df5500ac934a52b3a5c.jpeg)
为什么要把图表示成矩阵的形式?
邻接矩阵保留了图的全部信息,是全息的;计算机、算法都是通过矩阵的运算
(图翻译为计算机的语言)
![](https://i-blog.csdnimg.cn/blog_migrate/7d2ca8fe895faa92160c41a683da971d.jpeg)
drawback: sparse matrix
![](https://i-blog.csdnimg.cn/blog_migrate/221aa011374179e916f60ffa45397538.jpeg)
可以看到用邻接矩阵很浪费空间,所以一般用连接列表和邻接列表
6、图的基本表示-连接列表和邻接列表
![](https://i-blog.csdnimg.cn/blog_migrate/a92073b7578ee4bc33039e3e797c5ef4.jpeg)
![](https://i-blog.csdnimg.cn/blog_migrate/efd9050c893df7b1d7cbe515f46fdf89.jpeg)
Multigraph:
结点与结点之间存在多种关系(能吃、不能吃、推荐吃)
7、图的连通性
undirected graph:
总有一条路能让图的任意两个结点之间触达,称之为”虽远必诛“ (connected components)
connected components: Any two vertices can be jointed by a path.
A disconnected graph is made up by two or more connected components(连通域).
最大的连通域(Giant Component)
![](https://i-blog.csdnimg.cn/blog_migrate/675a41fa4657cc98a1a6cffe3b5b687f.jpeg)
instance:
![](https://i-blog.csdnimg.cn/blog_migrate/56b0c1a9d9aecabbad89a382ece5f38d.jpeg)
directed graph:
有向图中,任意两个节点可以相处触达:
Strongly connected directed graph(强连通图)
has a path from each node to every other node and vice versa (e.g., A-B path and B-A path)
Weakly connected directed graph(弱连通图)
is connected if we disregrad the edge directions
instance:
![](https://i-blog.csdnimg.cn/blog_migrate/dfcd55e15365d0cf9ca65c524e51e20a.jpeg)
subset is strong directed graph can be named strongly connected components(SCCs)
![](https://i-blog.csdnimg.cn/blog_migrate/b1c13a8bfc27682c7e359b2c2fc0f7c0.jpeg)
Summary
![](https://i-blog.csdnimg.cn/blog_migrate/5a1e13b84df2765ac4a1453af7750685.jpeg)