C # Data Structure-diagram

Source: Internet
Author: User

One: Figure

The graph structure abbreviation is another kind of nonlinear structure, which is more complex than the tree structure. The nodes in the tree structure are one-to-many relationships, with distinct hierarchical and branching relationships between nodes. The nodes of each layer can be related to multiple nodes in the next layer, but only to one node in the previous layer. the vertices in the graph ( the data elements in the graph are called vertices) are many-to-many relationships , that is, the relationship between vertices is arbitrary, and any two vertices in the graph may be related. In other words, there is no obvious hierarchical relationship between the vertices of the graph, and this kind of relationship exists in the real world. Therefore, the application of the graph is quite extensive, and it is widely used in many fields such as natural science, social science and humanities.

1.1: Basic concepts of graphs 1.1.1: Definition of diagram

  A graph is a collection of non-empty vertex (Vertex) sets and descriptions that describe the relationship between vertices-edge (edge) or arc (ARC). It is formally defined as:

G= (V,e)

V={v I |v i∈ A collection of data elements}
e={(v I, v j) |v I, v j∈v∧p (v I, v j)} or E={<v I, v J >|v I, v j∈v∧p (v I, v j)}

  Where G represents the graph, V is the set of vertices, and E is the set of edges or arcs. in Set E, P (VI,VJ) indicates that vertex VI and vertex VJ have an edge or arc connected to each other. An example of the diagram is given.

  

In figure (a), V={v 1, v 2, v 3, v 4, v 5}e={(v 1, v 2), (v 1, v 3), (v 2, v 4), (v 2, v. 5), (v 3, v 4)

  In figure (b), V={v 1, v 2, v 3, v 4, v 5} e={<v 1, v 2 >,<v 1, v 3 >,<v 2, v 3 >,<v 2, v 5 ><v 3, v 4 >,<v 4, V 1 >,<v 4, v 5;}.

Note: The non-edge is indicated by the parenthesis "()", and the edge is indicated by the angle bracket "<>".

1.1.2: Basic terminology of graphs

  1. No direction diagram: In one diagram, if any two vertices v I and V J constitute a pair (V I, v J) ∈e is unordered, That is , the connection between vertices has no direction, then the graph is called an undirected graph. Figure (a) is an no-show graph.

  2, the direction of the graph: in a diagram, if any two vertices v I and V J constitute a pair of <v I, v J >∈e is ordered , where the connection between vertices has a direction, then the graph is called a directed graph (Directed graph). Figure (b) is a forward graph.

  3, Edge, ARC, ARC Head, ARC Tail: The line between two vertices in the non-graph is called edge (Edge), edge with the top an unordered pair of points (V I, v J) , said Vertex v I and Vertex v J are mutually adjacent contacts (adjacency point), (V I, v J)Edge attachment with vertex v I and Vertex v J. the line between two vertices in the graph is called arc (ARC), and the arc is vertex Ordered pairs of <v I, v J > , the first node of an ordered pair is called the start point (or arc tail), and in the figure does not one end with an arrowhead; the second node of an ordered pair is called the end point (or arc Head), with the end of the arrow in the Diagram .

  4, without the full picture: In an no-map, if any of the two vertices have an edge connected, it is called the the graph is an undirected complete graph. It can be proved that there are n (n-1)/2 edges in a non-direction complete graph with n vertices.

5, full graph: In a graph if any Each of the two vertices has an opposite two arc , which is called the

  6, the degree of the vertex, the degree of penetration, the degree of: in the graph, the degree of Vertex v (degree) is attached to the top The number of sides of the point v , usually recorded as TD (v). in a forward graph, the degree of the vertex is equal to the degree of the vertex (in degree) and the sum of the degrees of the vertices . The degree of the vertex v is the number of arcs with the vertex v as the arc Head, which is recorded as the ID (v) , and the exit of Vertex V (out degree) refers to the number of arcs with that Vertex v as the arc tail, which is recorded as OD (v). the degree of the vertex v TD (v) = ID (v) + OD (v).

  For example, in the graph without direction (a), there are:

TD (V 1) =2 TD (V 2) =3 TD (V 3) =2 TD (V 4) =3 TD (V 5) =2
In the direction diagram (b), there are:
ID (v 1) =1 OD (v 1) =2 TD (v 1) =3
ID (v 2) =1 OD (v 2) =2 TD (v 2) =3
ID (v 3) =2 OD (v 3) =1 TD (v 3) =3
ID (v 4) =1 OD (v 4) =2 TD (v 4) =3
ID (v 5) =2 OD (v 5) =0 TD (v 5) =2

  

C # Data Structure-diagram

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.