邻接表删除节点的出边复杂度
A graph is a set of nodes or known number of vertices. When these vertices are paired together, we call it edges. An Edge is a line from one node to other. Every edge can have its cost or weight. Graphs are of two types Directed and Undirected. Directed graphs are the graphs in which the vertices are ordered and in undirected graphs the vertices are unordered.
图是一组节点或已知数量的顶点。 当这些顶点配对在一起时,我们称其为边。 边缘是从一个节点到另一节点的线。 每个边缘都有其成本或重量。 图有两种类型:有向图和无向图。 有向图是其中顶点是有序的图,而在无向图中,顶点是无序的。
![Graph in DS using C](https://www.includehelp.com/ds/Images/graph-a.jpg)
Image source: https://courses.cs.vt.edu/csonline/DataStructures/Lessons/Graphs/graph.gif
图片来源:https://courses.cs.vt.edu/csonline/DataStructures/Lessons/Graphs/graph.gif
Node is a vertex in the graph at a position. The Line between two nodes is an edge. The Edge can have weight or cost associated with it.
节点是图中某个位置的顶点。 两个节点之间的线是一条边。 边缘可能具有重量或成本。
Edge is the line connecting two nodes or a pair of nodes. An Adjacency matrix is a square matrix used to represent a finite graph. It contains the information about the edges and its cost. If the value at the Ith row and Jth column is zero, it means an edge do not exist between these two vertices. Else you got the edge and cost of that edge.
边缘是连接两个节点或一对节点的线。 邻接矩阵是用于表示有限图的方阵。 它包含有关边缘及其成本的信息。 如果第I行和第J列的值为零,则意味着这两个顶点之间不存在边。 否则,您将获得优势和优势。
![Graph in DS using C](https://www.includehelp.com/ds/Images/graph-1.jpg)
C++ code:
C ++代码:
#include <bits/stdc++.h>
using namespace std;
//to add node
voi