Graph is an Abstract Data Type in Computer Science.
There are two types:
- Undirected graph: Nodes can be related to any other node - there is not set order.
- Directed graph: Nodes have a strong relationship between each other abd there is a set order to go between (traverse) the nodes.
flowchart LR subgraph Undirected["Undirected graph"] UA((A)) <--> UB((B)) UA <--> UC((C)) UB <--> UD((D)) end subgraph Directed["Directed graph"] DA((A)) --> DB((B)) DA --> DC((C)) DB --> DD((D)) DC --> DD end
Anki
id: graph-definition deck: Computer Science::Data Structures tags: data-structures graph
Q: What real-world things can a graph model well? A: Relationships such as roads between cities, links between web pages, dependencies between tasks, or friendships between people.
id: directed-vs-undirected-graph deck: Computer Science::Data Structures tags: data-structures graph
Q: Why would a one-way street be modeled with a directed graph edge? A: The connection can be traveled in one direction but not necessarily the other.