refine translation of graph/graph.md
This commit is contained in:
parent
0774920d7f
commit
09a030357d
@ -19,18 +19,18 @@ If vertices are viewed as nodes and edges as references (pointers) connecting th
|
|||||||
Based on whether edges have direction, graphs can be divided into <u>undirected graphs</u> and <u>directed graphs</u>, as shown in the figure below.
|
Based on whether edges have direction, graphs can be divided into <u>undirected graphs</u> and <u>directed graphs</u>, as shown in the figure below.
|
||||||
|
|
||||||
- In undirected graphs, edges represent a "bidirectional" connection between two vertices, for example, the "friendship" in WeChat or QQ.
|
- In undirected graphs, edges represent a "bidirectional" connection between two vertices, for example, the "friendship" in WeChat or QQ.
|
||||||
- In directed graphs, edges have directionality, that is, the edges $A \rightarrow B$ and $A \leftarrow B$ are independent of each other, for example, the "follow" and "be followed" relationship on Weibo or TikTok.
|
- In directed graphs, edges have directionality, that is, the edges $A \rightarrow B$ and $A \leftarrow B$ are independent of each other, for example, the "follow" and "followed" relationship on Instagram or TikTok.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Based on whether all vertices are connected, graphs can be divided into <u>connected graphs</u> and <u>disconnected graphs</u>, as shown in the figure below.
|
Based on whether all vertices are connected, graphs can be divided into <u>connected graphs</u> and <u>disconnected graphs</u>, as shown in the figure below.
|
||||||
|
|
||||||
- For connected graphs, it is possible to reach any other vertex starting from a certain vertex.
|
- For connected graphs, it is possible to reach any other vertex starting from an arbitrary vertex.
|
||||||
- For disconnected graphs, there is at least one vertex that cannot be reached from a certain starting vertex.
|
- For disconnected graphs, there is at least one vertex that cannot be reached from an arbitrary starting vertex.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
We can also add a weight variable to edges, resulting in <u>weighted graphs</u> as shown in the figure below. For example, in mobile games like "Honor of Kings", the system calculates the "closeness" between players based on shared gaming time, and this closeness network can be represented with a weighted graph.
|
We can also add a weight variable to edges, resulting in <u>weighted graphs</u> as shown in the figure below. For example, in Instagram, the system sorts your follower and following list by the level of interaction between you and other users (likes, views, comments, etc.), and this interaction network can be represented with a weighted graph.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -42,7 +42,7 @@ Graph data structures include the following commonly used terms.
|
|||||||
|
|
||||||
## Representation of graphs
|
## Representation of graphs
|
||||||
|
|
||||||
Common representations of graphs include "adjacency matrices" and "adjacency lists". The following examples use undirected graphs.
|
Common representations of graphs include "adjacency matrix" and "adjacency list". The following examples use undirected graphs.
|
||||||
|
|
||||||
### Adjacency matrix
|
### Adjacency matrix
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ As shown in the figure below, let the adjacency matrix be $M$, and the list of v
|
|||||||
Adjacency matrices have the following characteristics.
|
Adjacency matrices have the following characteristics.
|
||||||
|
|
||||||
- A vertex cannot be connected to itself, so the elements on the main diagonal of the adjacency matrix are meaningless.
|
- A vertex cannot be connected to itself, so the elements on the main diagonal of the adjacency matrix are meaningless.
|
||||||
- For undirected graphs, edges in both directions are equivalent, thus the adjacency matrix is symmetric about the main diagonal.
|
- For undirected graphs, edges in both directions are equivalent, thus the adjacency matrix is symmetric with regard to the main diagonal.
|
||||||
- By replacing the elements of the adjacency matrix from $1$ and $0$ to weights, it can represent weighted graphs.
|
- By replacing the elements of the adjacency matrix from $1$ and $0$ to weight values, it can represent weighted graphs.
|
||||||
|
|
||||||
When representing graphs with adjacency matrices, it is possible to directly access matrix elements to obtain edges, thus operations of addition, deletion, lookup, and modification are very efficient, all with a time complexity of $O(1)$. However, the space complexity of the matrix is $O(n^2)$, which consumes more memory.
|
When representing graphs with adjacency matrices, it is possible to directly access matrix elements to obtain edges, thus operations of addition, deletion, lookup, and modification are very efficient, all with a time complexity of $O(1)$. However, the space complexity of the matrix is $O(n^2)$, which consumes more memory.
|
||||||
|
|
||||||
@ -78,6 +78,6 @@ As shown in the table below, many real-world systems can be modeled with graphs,
|
|||||||
|
|
||||||
| | Vertices | Edges | Graph Computing Problem |
|
| | Vertices | Edges | Graph Computing Problem |
|
||||||
| --------------- | ---------------- | --------------------------------------------- | -------------------------------- |
|
| --------------- | ---------------- | --------------------------------------------- | -------------------------------- |
|
||||||
| Social Networks | Users | Friendships | Potential Friend Recommendations |
|
| Social Networks | Users | Follow / Followed | Potential Following Recommendations |
|
||||||
| Subway Lines | Stations | Connectivity Between Stations | Shortest Route Recommendations |
|
| Subway Lines | Stations | Connectivity Between Stations | Shortest Route Recommendations |
|
||||||
| Solar System | Celestial Bodies | Gravitational Forces Between Celestial Bodies | Planetary Orbit Calculations |
|
| Solar System | Celestial Bodies | Gravitational Forces Between Celestial Bodies | Planetary Orbit Calculations |
|
||||||
|
Loading…
Reference in New Issue
Block a user