You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: notes/graphs.md
+38-23Lines changed: 38 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ Here, the matrix indicates a graph with vertices A to D. For instance, vertex A
80
80
81
81
**Benefits**:
82
82
83
-
- Fixed-time ($O(1)$) edge existence checks.
83
+
- Fixed-time ($O(1)$) edge existence checks.
84
84
- Particularly suitable for dense graphs, where the edge-to-vertex ratio is high.
85
85
86
86
**Drawbacks**:
@@ -113,56 +113,71 @@ This list reflects the same graph as our matrix example. Vertex A's neighbors, f
113
113
- Edge existence checks can take up to $O(V)$ time in the worst case.
114
114
- Potentially consumes more space for dense graphs.
115
115
116
-
In practice, the choice between these (and other) representations often depends on the graph's characteristics and the specific tasks or operations envisioned.
116
+
The choice between these (and other) representations often depends on the graph's characteristics and the specific tasks or operations envisioned.
117
117
118
118
### Planarity
119
119
120
-
Planarity is a fundamental concept in graph theory that examines whether a graph can be drawn on a flat surface without any of its edges overlapping. This idea holds significant importance in areas such as circuit design, urban planning, and geography.
120
+
Planarity examines whether a graph can be drawn on a flat surface (a plane) without any of its edges crossing. This idea holds significant importance in areas such as circuit design, urban planning, and geography.
121
121
122
122
#### What is a Planar Graph?
123
123
124
-
A graph is considered "planar" if there exists a representation of it on a two-dimensional plane where its edges intersect only at their vertices and nowhere in between. Being able to redraw a graph without any edges crossing, even if it starts out messy with overlaps, is what shows if it’s planar or not.
124
+
A graph is considered **planar** if there exists a representation (also called a drawing) of it on a two-dimensional plane where its edges intersect only at their vertices and nowhere else. Even if a graph is initially drawn with overlaps or crossings, it may still be planar if it is possible to **redraw** (or **rearrange**) it so that no edges intersect in the interior of the drawing.
125
+
126
+
An important theoretical result related to planarity is **Kuratowski’s Theorem**, which states that a graph is planar if and only if it does not contain a subgraph that is a subdivision of either $K_5$ (the complete graph on five vertices) or $K_{3,3}$ (the complete bipartite graph on six vertices, partitioned into sets of three).
125
127
126
128
#### Planar Embedding
127
129
128
-
A "planar embedding" refers to a way of drawing a graph on a plane so that none of its edges cross each other. If a graph is first drawn with overlapping edges, it’s considered planar if you can rearrange it so no edges cross.
130
+
A **planar embedding** refers to a specific way of drawing a graph on a plane so that none of its edges cross each other in the interior. If such a crossing-free drawing exists, the graph is planar. A related fact is **Euler’s Formula** for planar graphs:
131
+
132
+
$$|V| - |E| + |F| = 2$$
133
+
134
+
where:
135
+
136
+
- $|V|$ is the number of vertices,
137
+
- $|E|$ is the number of edges,
138
+
- $|F|$ is the number of faces (including the "outer" infinite face).
129
139
130
140
#### Examples
131
141
132
-
To understand planarity better, let's explore some examples:
142
+
I. **Cycle Graphs**
133
143
134
-
1.**Cycle Graphs**: Graphs like triangles, squares, or hexagons, which are simple loops or cycles, are intrinsically planar. These shapes can always be illustrated without intersecting edges.
144
+
Simple cycle graphs (triangles, squares, pentagons, hexagons, etc.) are planar because you can easily draw them without any edges crossing. In the square cycle graph $C_4$ example below, there are no intersecting edges:
135
145
136
146
```
137
147
A-----B
138
148
| |
139
149
C-----D
140
150
```
141
151
142
-
2.**Complete Graph with Four Vertices ($K_4$)**: This graph has every vertex connected to all other vertices. Despite its complexity, $K_4$ remains planar and resembles a tetrahedron.
152
+
II. **Complete Graph with Four Vertices ($K_4$)**
153
+
154
+
This graph has every vertex connected to every other vertex. Despite having 6 edges, $K_4$ is planar. Its planar drawing can resemble a tetrahedron (triangular pyramid) flattened onto a plane:
143
155
144
156
```
145
-
#
146
-
A--------
147
-
/ \ |
148
-
B---C |
149
-
\ / |
150
-
D--------
157
+
A
158
+
/ \
159
+
B---C
160
+
\ /
161
+
D
151
162
```
152
163
153
-
3.**Complete Graph with Five Vertices ($K_5$)**: Unlike $K_4$, $K_5$ cannot be sketched without crossing edges, thus classifying it as non-planar.
164
+
III. **Complete Graph with Five Vertices ($K_5$)**
165
+
166
+
$K_5$ has every one of its five vertices connected to the other four, making a total of 10 edges. This graph is **non-planar**: no matter how you try to arrange the vertices and edges, there will always be at least one pair of edges that must cross. A rough sketch illustrating its inherent crossing is shown below:
154
167
155
168
```
156
-
#
157
-
- A -
158
-
/ / \ \
159
-
/ | | \
160
-
B----+-----+---C
161
-
\ | | /
162
-
\ D-----E /
169
+
A
170
+
/|\
171
+
/ | \
172
+
B--+--C
173
+
\ | /
174
+
\|/
175
+
D
176
+
|
177
+
E
163
178
```
164
179
165
-
In the $K_5$ graph, edges like AD and AE overlap with BC.
180
+
Attempting to avoid one crossing in $K_5$ inevitably forces another crossing elsewhere, confirming its non-planarity.
0 commit comments