& Lt; Study Notes & gt; theoretical knowledge about graphs and Study Notes

Source: Internet
Author: User

<Study Notes> theoretical knowledge about graphs and notes
What is a graph | ω ・')

Figure G is an Ordered Binary Group (V, E), where V is called the Vertices Set, E is called the Edges set, and E is not intersecting with V. They can also be written as V (G) and E (G ).

The elements of E are binary groups, expressed by (x, y), where x, y, and V. (From Baidu encyclopedia)

 

In short, a graph is composed of vertices and edges. It can also be understood as the abstract representation of the relationship between several elements, and the edge represents the relationship between the corresponding vertex.

Graph classification | ω ・ ') 1. Directed Graph and undirected graph:

If we specify the direction for each edge in the graph, that is, the order of vertex x and y in the edge <x, y> cannot be reversed at will, this graph is called a directed graph, the opposite is an undirected graph.

2. Single chart:

If an image has only one edge between any two vertices (in a directed graph, there is only one edge between two vertices in each direction), and the edge set does not contain loops, it is called a single graph.

3. Connected Graphs, non-connected graphs, and strongly connected graphs:

In an undirected graph, if a path exists between the vertex vi and the vertex vj, the vi is connected to the vj. If any two vertices in the graph are connected, the graph is called a connected graph. Otherwise, the connected subgraph is called a connected component. In a directed graph, if each pair of vertices vi and vj have paths from vi to vj and from vj to vi, the graph is strongly connected. Otherwise, the hyperconnected subgraph is called a strongly connected component.
* Directed Graphs without loops are called DAG.

4. simple graph and tree:

If any vertex x and y have only one edge to connect them, that is, the edge set does not contain two or more (x, y), then graph G is called a simple graph. A simple chart can be expressed in a matrix.
A undirected connected graph without loops is called a undirected tree.
If a directed graph is changed to an undirected tree, the directed graph is called an undirected tree.
Special: a point is also called a tree. If there are many trees, they are called forests.
If a vertex x exists in the direction tree so that it can reach all the other vertices from x, then the direction tree G = (V, E) is called the tree embedding rooted in x.

Graph definition | ω ・')
  • Order: The size of V in the top set of graph G (that is, the number of vertices ).
  • Degree (Degree): the Degree of a vertex refers to the number of edges connected to the vertex. The Degree of vertex v is recorded as d (v ).

    * Inbound and outbound: In a directed graph, the inbound degree of a point is the number of paths ending with this point, and the outbound degree is the number of paths starting with this point.

  • Sub-Graph: When the Graph G' = (V', E '), where V is included in V, E is included in E, then G' is called the subgraph of graph G = (V, E. Each graph is a subgraph of itself.
  • Spanning Sub-Graph: if the point set of Graph g is the same as that of Graph G, and the edge set of g is included in the edge set of G, g is called the generation subgraph of G. In particular, if g is a undirected tree, g is called the generative tree of graph G.
  • Export Subgraph: A non-empty subset of V in the top set V1. The whole edge in V1 is the G Subgraph of the edge set, it is called the export subgraph exported by V1. The edge set E1 is a non-empty subset of E, and the whole of the vertex associated with the edge in E1 is the subgraph of G of the vertex set, it is called the export subgraph exported by E1.

    * We can see that any subgraph of graph G can be seen as a subgraph generated by an export subgraph of graph G.

  • Path: a Path from u to v refers to a sequence of v0, e1, v1, e2, v2 ,... Ek, vk, (A-1-> B-2-> C ...), The vi and vi-1 vertices of the ei, and k are called the path length. If its starting and ending vertices are the same, the path is "closed". Otherwise, it is called "open. If all vertices except u and w are not equal, this path is called a simple path.

    * Path length: the number of edges passing by a path.
    * Length: the sum (possibly negative) of the weights of all edges in the path ).

  • Trace: If the edges in the path P (u, v) are different, the path is called a Trace from u to v.
  • Track: If the vertices in the path P (u, v) are different, the path is called a Track from u to v.
    * Closed traces are called loops, and closed tracks are called Cycle)
  • Ring: If the start and end of a path are the same, the path is called a loop ).
  • Loop: If two vertices of an edge are the same vertex, this edge is called a self-ring.
  • Bridge: if an edge is removed, the entire graph is not connected. This edge is called a Bridge.
  • Cut point: if a vertex is removed, the entire graph is not connected, and the vertex becomes a cut point.

(Refer to Baidu encyclopedia)

Graph storage | ω ・')

1. List: open three arrays to record the start, end, and weight of each edge.
2. Adjacent matrix: f [I] [j] = d indicates an edge with a weight of d from I to j.
3. Adjacent table: store each edge with a linked list and struct, and write down the edge connected by each vertex.
4. The cross-linked list storage representation of the directed graph.
5. An undirected graph is stored in multiple adjacent tables.

* In a non-weighted graph, if two points are not adjacent, the corresponding position of the adjacent matrix is 0. For a weighted graph (network), the corresponding position is ∞. The adjacent matrix of a graph is unique, but its adjacent table is not unique.

* In a directed graph, edges are usually called arcs. One end with arrows is called an arc header, and the other end is called an arc tail. This is recorded as <vi, vj>, it indicates that an edge exists from vertex vi to vertex vj. If a directed graph contains n vertices, a maximum of n (n-1) arcs exist. We call a directed graph with n (n-1) arcs as a directed complete graph. The number of arcs ending with vertex v is called the degree of output of vertex v, and the number of arcs starting with vertex v is called the entry of vertex v.

* In an undirected graph, the edge is recorded as (vi, vj), which contains two arcs: <vi, vj> and <vj, vi>. If n vertices exist in an undirected graph, n (n-1)/2 arcs are allowed at most, and an undirected graph with n (n-1)/2 arcs is called a undirected complete graph. The number of edges related to vertex v is called the degree of vertex v.
(From Baidu encyclopedia)

Graph traversal | ω ・')

Deep Search (dfs) and breadth search (bfs ).

Edge in the tree | ω ・')
    • Tree edge refers to the edge used to locate the child node from the parent node
    • Forward edges refer to non-tree edges pointing from the ancestor node to the child node.
    • Backward edges refer to the edges pointing back from the child node to the ancestor node.
    • The cross-border refers to the edge between two nodes without the relationship between grandparents. The traversal order of the start point is after the end point.

PS: Let's sort it out first, and then add 2333 Gbit/s too many Gbit/s) o

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.