Graph Theory Flashcards
Who is the birth of graph theory attributed to?
Euler and the Seven Bridges of Konigsberg problem
Examples of real world problems formulated as graphs
- What is the fastest way to get from city A to city B? or
- What is the cheapest way to get from city A to city B?
- Are all the circuits in a computer connected?
- Social Connections
What is a graph?
- A graph is a collection of vertices (nodes) and edges (arcs)
- G = (V,E)
- Vertices (V) are objects that have properties associated with them
- Edges (E) normally do not have properties (values) but they may have.
- Graphs that have valued edges are called weighted graphs
Where might the shape of the graph matter?
For instance, if we’re representing cities as they appear in the map we may
not want to change the shape of the graph
• We may want a more realistic representation for the cities’ locations.
What is a graph path?
A path from node A to node B in a graph is a list of nodes where successive nodes are connected in the graph
What is a simple path?
• A simple path is a path in which no node is repeated
What is a cycle?
A cycle is a path that is simple except that the first and the last nodes are the same.
It is a path from a node back to itself.
Difference between a directed and undirected graph
• A connected (undirected) graph with no cycles is called a tree
What is a spanning graph?
A spanning tree T of an undirected graph G is a subgraph that is a tree which includes all of the vertices of G, with minimum possible number of edges.
How many edges can be in a graph?
• The number of edges in a graph can range from 0 (zero) to V(V-1)/2.
V = Vertices
What is a sparse graph?
- We call a sparse graph a graph in which E is much less than V2
- In general we say that in a sparse graph E = O(V)
What is a dense graph?
We call a dense graph one in which E is close to V2
• Or we say that in a dense graph E = Θ(V2)
What is a complete graph?
- We call a complete graph a graph in which E is exactly V(V-1)/2
- A complete graph with k nodes is also called a k-clique.
What is an adjacency list?
A way to represent a graph (usually sparse).
Consists of an array, adj, of all nodes in the graph.
For each node, i, adj[i] is a list of all other nodes i is connected to.
What is an adjacency matrix?
Preferred when representing dense graphs.
i x i matrix, where there are 1s between connected nodes.
Always symmetrical in undirected graphs.