Graph data structure (Graph)
What is the graph data structure?
A graph (graph) is a form of visual representation of a set of objects in which pairs of objects are connected by links. Interconnected objects are represented by points called vertices, and links that connect vertices are called edges.
In general, a graph is a set of sets (V, E), where V is a set of vertices and E is a set of edges that connect point pairs. You follow the following graph:
In the above graph:
V = {a, b, c, d, e}
E = {ab, ac, bd, cd, de}
Graph data structure (Graph)
Mathematical shapes can be represented in data structures. We can represent a shape using an array of vertices and a two-dimensional array of edges. Before continuing, we explore some of the following important concepts:
Vertex (Vertex) : Each node of the shape is represented as a vertex. In the example below, circles represent vertices. Therefore, points from A to G are vertices. We can represent these vertices using an array, where vertex A can be identified by index 0, point B is index 1 . as shown below.
Edge (Edge) : The edge represents a line connecting the two vertices. In the figure below, the lines A and B, B and C, . are the edges. We can use a two-dimensional array to represent these edges. In the example below, AB can be represented as 1 in row 0; BC is 1 in row 1, column 2, .
Juxtaposition : The two vertices are contiguous if they are connected through an edge. In the figure below, B is adjacent to A; C is close to B, .
Road : Line represents a series of edges between two vertices. In the figure below, ABCD represents a line from A to D.
Basic operations on graph data structure
Following là cơ sở dữ liệu chính chính của một Graph, mà theo sau.
Add vertices : Add a vertex in the graph.
Add edges : Add an edge between two vertices of a graph.
Peak display: Displays a vertex of a graph.
This chapter is only an introduction to the Graphical Data Structure, to refer to this data structure, you can refer to some documents on Tutorialspoint or from any other source.
According to Tutorialspoint
Previous lesson: Quick Sort (Quick Sort)
Next lesson: Deep search algorithm
You should read it
- Search algorithm by width
- Deep search algorithm
- How to implement a graph data structure in Golang
- What is Data Structure?
- Stack data structure (Stack)
- Queue data structure (Queue)
- Hash Table data structure
- How to Add a Second Y Axis to a Graph in Microsoft Excel
- Detailed instructions on how to graph in excel
- Structure (Struct) in C #
- Data structure in C / C ++
- How to Make a Bar Graph in Excel
Maybe you are interested
How to update graphics drivers in Windows 10 and 11
Nvidia discontinues one of its most powerful graphics cards
How to reset graphics driver on Windows 10/11
6 Best CPUs with Integrated Graphics for Gaming
Why is street photography with a smartphone better than a DSLR camera?
Photography rules to help improve photos taken with smartphones