Skip to content

Commit f04c5fa

Browse files
committed
Lesson 6, graphs
1 parent 80cdea9 commit f04c5fa

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

6-graphs/GraphNotes.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
### Graph
2+
3+
A graph is a network. It has nodes (also known as vertexes) and they are connected by edges. A tree is actually a type of graph!
4+
5+
We might think a node stores data and an edge doesn't, but actually an edge can store data too!
6+
7+
For example, we could have nodes that represent people, and nodes have a value that is their name. Perhaps the edges that connect them indicate that they met, or that they're in the same city. The edges can contain data baout the strength of their connection--maybe they met and they're great friends, so this edge is worth 6 instead of 2.
8+
9+
Or maybe the nodes represent airports, and edges indicate how long the flights are or maybe how expensive the flight is. And you could try to minimize the price cost as you navigate through the graph.
10+
11+
### Directions and Cycles
12+
13+
A Directed Graph, or a digraph, is one that has a direction. The edges have arrows that point in one direction.
14+
15+
An undirected graph is one that points in both directions.
16+
17+
A cycle is when you can start at a node and follow edges all the way back to the node.
18+
19+
A directed acyclic graph (DAG) is a directed graph with no cycles!
20+
21+
### Connectivity
22+
23+
Connectivity, in Graph Theory, indicates the level of connections between nodes. If I can remove one edge and it breaks the nodes into separate chunks (disconnected graph) then it's less connected than something that can have more edges removed.
24+
25+
A directed graph is weakly connected when only replacing all of the directed edges with undirected edges can cause it to be connected. So if you have a vertex that has an outbound edge but not an inbound edge, and if you replace that edge with a undirected edge it allows connectivity to that vertex, then that graph was weakly connected.
26+
27+
Strongly connected directed graphs have a path from every node to every other node. A to B and B to A.

0 commit comments

Comments
 (0)