Graphs - adamtew/CS2420-Exam2 GitHub Wiki
-
nodes
-
relationships (Arcs/edges)
-
child is called successor
-
things that are touching are called adjacent
-
parent is called a predecessor
Examples:
Example | Node | Arc(Relationship) |
---|---|---|
Ages | People | |
Digital Logic | ||
Starting Salary | Major | Salary |
Networking | ||
Candy Bars | ||
Test to see | ||
Social Network | People | Relationship to person |
This class is called a "Bipartite" graph
Annotative graph Example: Starting Salary Node: Student Arc: Salary
Stored
Array or linked lists or adjacency matrix
Adjacency Matrix
0 1 2 3 4 5
_____________
0|_|x|_|_|_|_|
1|_|_|_|_|_|_|
2|_|_|_|x|_|_|
3|_|_|_|_|_|_|
4|_|x|_|_|_|_|
5|_|_|_|_|_|_|
- successor -> look at the row
- Predecessor -> look at the column
- Intense on the memory
Time Space Tradeoff