1.4.2. Graphs Flashcards
(10 cards)
What is a graph?
Set of vertices or nodes connected by edges or arcs
Edges may be one way or two way
What is a digraph of directed graph?
When edges in graph are all one way
What does it mean for an edge to be adjacent?
If 2 vertices are connected by an edge they are adjacent
How are undirected graphs drawn?
Order of pairs in edges don’t matter as edges go both ways
So drawn using straight lines with no arrowheads between vertices
Difference between directed and undirected
Undirected edges go in both directions (no order or direction is specified)
Directed graphs - edges specify direction - order of edges matter
How are directed graphs drawn!
Edges drawn using arrowheads MISS
What does it mean by a graphs is weighted?
Each edge has a value representing a cost or relationship between vertices
Value can represent many things depending on context (time, distance money etc)
What is a directed graph?
Notes
Advantages
Very convenient
Very easy to work with
Adding edges is v simple
Disadvantages for adjacent matrices
Large amounts of memory space can be wasted in graphs with many nodes but only a few edges as most of cells will be empty
Using static 2 dimensional arrays can be difficult to make changes adding and deleting nodes etc