Undirected (Ungerichteter) Graphs
An undirected graph is made-up of a set of vertices ( is the vertex set, de: Knotenmenge) and a set of edges (edge set, de: Kantenmenge).
The standard notation for and for .
Every element is an unordered pair (where ).
- The vertices (Knoten) are called endpoints (Endpunkte) of .
- We call adjacent (adjazent oder benachbart) to and incident (inzident oder anliegend).
- The degree (Knotengrad) of a vertex is the number of edges that are incident to , i.e. .
- If a vertex has , it is called an isolated vertex (isolierter Knoten).
Vocabulary:
- A sequence of vertices (with for all ) is a walk (german “Weg”) if is an edge for each . We say that and are the endpoints (german “Startknoten” and “Endknoten”) of the walk. The length of the walk is .
- A walk of length connects vertices!
- A sequence of vertices is a closed walk (german “Zyklus”) if it is a walk, and .
- A sequence of vertices is a path (german “Pfad”) if it is a walk and all vertices are distinct (i.e., for ).
- A sequence of vertices is a cycle (german “Kreis”) if it is a closed walk, and all vertices (except and ) are distinct.
- An Eulerian walk (german “Eulerweg”) is a walk that contains every edge exactly once.
- A closed Eulerian walk (german “Eulerzyklus”) is a closed walk that contains every edge exactly once.
- A Hamiltonian path (german “Hamiltonpfad”) is a path that contains every vertex.
- A Hamiltonian cycle (german “Hamiltonkreis”) is a cycle that contains every vertex.
- For , we say reaches (or is reachable from ; german ” erreicht ”) if there exists a walk with endpoints and , or equivalently, there exists a path with endpoints and .
- This reachability relation is an equivalence class.
- A connected component of (german “Zusammenhangskomponente”) is an equivalence class of the (equivalence) relation defined as follows: Two vertices are equivalent if reaches .
- A graph is connected (german “zusammenhängend”) if for every two vertices , reaches , or equivalently, if there is only one connected component.
- A graph is acyclic (german “azyklisch”) if it does not have any cycles.
- A graph is a tree (german “Baum”) if it is connected and has no cycles.
- A graph is complete when it’s set of edges is .
- A graph is transitive when for any two edges and in , the edge is also in .
- A graph is bipartite if it’s possible to partition the vertices into two sets and that are disjoint and cover the graph. Any edge has to have one endpoint in and the other in .
Self loops (Schleifen) are not allowed and can only appear once in the set of edges (no multigraphs, Multigraphen).
Directed (Gerichtete) Graphs
In a directed graph, an edge is an ordered pair of vertices where
- is the direct successor (Nachfolger) of
- is the direct predecessor (Vorgänger) of We also call the start vertex (Startknoten) and the end vertex (Endknoten) of .
We now differentiate between the in-degree (Eingangsgrad) and the out-degree (Ausgangsgrad) of a vertex v:
- the in-degree is the number of edges that have as the end vertex
- The out-degree is the number of edges that have as the start vertex
A vertex with is called a source (Quelle) and a vertex with is called a sink (Senke).
Vocabulary
- All walks, closed walks, paths and cycles are now called directed (gerichteter).
- For we say that reaches (erreicht) if there is a directed path with endpoints and .
- A graph is called a directed acyclic graph or DAG (gerichteter azyklischer Graph) if there is no directed cycles.
- Two vertices are strongly connected if there exists both a path from to and to .
Same as for undirected graphs, self loops are not allowed and there cannot be multiple . We can however have .
Cut Vertex and Edges
A vertex in a connected graph is called a cut vertex (or articulation point) if the subgraph obtained by removing and all it’s incident edges is disconnected.
An edge in a connected graph is called a cut edge (or bridge) if the subgraph obtained by removing (but keeping all vertices) is disconnected.
Bipartite Graph
A graph is bipartite if it’s possible to partition the vertices into two sets and that are disjoint and cover the graph. Any edge has to have one endpoint in and the other in .
Bipartite Graph
A graph is bipartite if and only if it does not contain any odd cycles.
Representations
Adjacency Matrix
The matrix representing an undirected graph is always symmetric.
Adjacency List
. Represented as a list of lists in memory.
Runtimes
| Op/Run | Adj. Matrix | Adj. List |
|---|---|---|
| List successors |