Netwirks and Graphs
Netwirks and Graphs
Nodes
Edges:
Lines from nodes
Neighbor set:
All adjacent vertices but not itself.
Simple graph:
Not contain edges between same vertices and no loops. So not: A→ B and B → A. but only
B--A would be ok. Most graphs considered are simple.
Degree of a vertex v :
Number of edges that come into a vertex v. Loops counted twice.
Handshaking lemma:
Sum of the degree of all vertices in G = 2|E(G)| = 2 * the number of edges of graph G
Because when we count each edge of all vertices we count each edge twice.
Degree sequence:
List of degrees of vertices in a graph. It is ordered if numbers are in non-increasing order.
Graphic sequence:
If it is the degree sequence of a simple graph.
Adjacency matrix:
Properties:
Must be symmetric, if its at [v1,v2] must also be same at [v2,v1]
Simple graph means that diagonal (left to right) must be 0 and each value can at most be 1.
Sum of the numbers on each row must be equal to the degree of that vertex.
Incidence matrix:
Properties:
Sum of each column must be 2
Sum of each row must be equal to the degree of that vertex.
If there are less edges than vertices this matrix will be smaller than the adjacency matrix.
Subgraphs:
Being a subgraph means that: the vertices of this graph need to be in the set of vertices of
graph G and the same for the edges. We can see this in the example above.
The last 2 definitions mean that if we take the vertices for a new sub-graph we also get the
edge set that belongs to these vertices. We can do this the other way around as well by first
taking the edges and then adding the vertices in between to connect this graph.
Isomorphic:
Graphs G1 and G2 are isomorphic if you could reposition the vertices and create the graph.
Try to check if each vertex has the right amount of edges.
Theorem of Havel-Hakimi:
If the sub-graph of any graph is a graphical sequence then the graph itself is a graphical
sequence aswell.
Example:
Case 1: We remove S and do the next 4 -1
To deduce whether a given ordered sequence A is graphic or not:
We repeatedly reduce the size of A by applying the “only if direction” of Havel Hakimi
Theorem until we reach a small-size base-case sequence B (See above examples).
If B is graphic, A is graphic.
Otherwise A is not graphic.
Component of a graph:
A component of a graph G means that it is a connected subgraph that does not have any
other connections to add to this graph. Example:
Vertex cut:
If removing this vertice or vertices would result in a disconnected graph you may call this a
vertex cut.
Edge cut:
If we remove this edge(s) we would make the graph a non-connected graph.
K-connected graphs:
A graph is k-connected if κ(𝐺) ≥ 𝑘.
How to create a k-connected graph:
If k is even:
In this example they want a 4-connected graph. This means that it would take κ(𝐺)= 4 to
disconnect the graph. We can see this in the notation H4, 8 . This means 4 disconnections
and 8 vertices. Since the k is even, for each vertice this means that we do k/2 connections to
the left and the right. So we do 4/2 = 2 connections on each side. See left graph.
If k is odd, n is even:
Insert same graph for Hk-1,n and then add:
<0,n/2> , <1, 1+ n/2>, … ,<(n-2)/2, n-1>
If k is odd, n is odd:
Insert same graph for Hk-1,n and then add:
<0, (n-1)/2>, <1, 1+(n-1)/2>, … , <(n-1)/2, n-1>,
Harary graphs:
Simple graphs. See examples above for how to construct them.
Vertex independent:
Two paths are vertex independent if they do not share any vertices. This means for example
Menger’s theorem:
The minimum size of a vertex cut disconnecting nonadjacent vertices u and v equals the
maximum size of the vertex-independent set P(u,v). This makes sense because if you’d
want to create a vertex cut between u and v you’d have to disconnect all possible routes to
this. This would mean that if you disconnect all vertex independent paths you’d have no
paths possible to these vertices anymore. And this is the minimal way of doing it
This means that first we start with N0 (v) = {v} . This is the first vertex. Now we want to get
Nk+1(v) , aka the next vertices that are connected to v. We first take all the neighbors from v
but subtract it with the already counted vertices before. If you redraw this graph you’d go
from the left graph to the right one:
We slowly draw all the neighbors of all the vertices above each other so that it is easy to see
if this graph is bipartite or not. If there is no edge between every other row, and only edges
between neighbor rows, the graph is bipartite.
So basically if no edges cross then its planar. Has to also be simple and connected.
If a graph is already planar and you remove any edge it's going to stay planar.
Example; It seems not planar but if we draw one edge around the vertices we see that it is.
Bounded region:
Surrounded by a set of edges.
Everything besides R1.
Unbounded region:
Not surrounded by a set of edges.
R1
Euler’s formula:
Vertices - edges + regions = 2
Argue that the complete graph with 5 vertices is not planar. We can use the theorem to
prove that this doesn't hold for this graph and for that reason cannot be planar. See
following:
Planar graph theorem:
Every planar graph G has at least one vertex v with degree of vertex <= 5
Directed graphs:
Each edge now has a direction.
A digraph D consists of sets V(D) of vertices and A(D) of arcs. Arcs are now what we call a
directed edge.
Each arc <U,V> with an arrow on top of this, joins vertex u (the tail) to vertex v (the head).
Basic properties:
In a digraph, the indegree of vertex v is the number of arcs with head v, and
Sum of indegrees must be equal to sum of outdegrees and both must be equal to the
number of arcs.
- Strict if the numbers in the diagonal are zero and the numbers in the matrix are at
most one.
- For every row the sum of the numbers on that row should be equal to the out
degrees of the vertex of that row.
Incidence matrix for directed graphs:
Incidence matrix has n rows and m columns if the graph has n vertices and m arcs.
Path:
Has to go over different vertices. The previous example is not a path because we re-use the
vertices.
Directed cycle:
A cycle in a directed graph lol.
Strongly connected:
Two vertices are strongly connected if there is both a (u,v) path as a (v,u)-path.
Example:
2,4 are strongly connected because there is a path to 2,4 through 3 and a different path
directly from 2 to 4. So we can find 2 paths and this is why it is strongly connected.
Theorem:
There is a strongly connected orientation of G if and only if λ(𝐺) ≥ 2.
Edge colourings:
Assign colours to edges such that edges that incident to the same vertex always have
different colours.
Example:
We can group the bottom edges to group 1, the side ones to group 2 and the middle on to
group 3. This way we have no edges next to each other in the same group.
So we can see that the amount of colours will be equal or bigger than the maximum degree
in G.
Theorem:
Vertex colourings:
A simple graph G is k-vertex colourable if V(G) can be partitioned into sets V1 , …, Vk such
that each distinct pair of vertices in a vi for any i=1 , … , k, isn’t adjacent.
So basically no colours are neighbors of each other.
Chromatic number:
Chromatic number X(G) is the minimum k for which G is k-vertex colourable.
Random question Ali started to ask:
Answer:
Theorem:
𝑋(𝐺) ≤ ∆(𝐺) + 1
For any graph G the chromatic number of G is at least the maximum degree of G + 1.
No,
Vertices with an odd degree must be the start or end point of the walk. Since all four vertices
have an odd degree, there is no solution.
Closed walk:
A walk is closed if the start of the walk and the end of the walk are the same.
Trail:
A walk that traverses each edge at most once.
Tour:
Euler tour:
A tour that traverses each edge exactly once. Euler trail is a trail that traverses each edge
exactly once.
They seem very similar, both have to travel exactly once. In a tour the start and the end need
to be the same.
A connected graph G has an Euler tour if and only if all its vertices have an even degree.
Fleury’s algorithm:
An elegant but inefficient algorithm to build an Euler tour. Consider a connected graph G in
which all vertices have an even degree.
So basically, a connected graph has a Euler trail if and only if it has exactly two vertices of
odd degree and the trail ends in the vertices with the odd degree.
Hierholzer’s algorithm:
So basically we do:
1. Start from arbitrary vertex v in G and build a trail P until no new edge can be
traversed.
2. If G is not empty then remove P from G and repeat step 1.
3. If G is empty then merge the trail found in step 1 to get a tour for G.
In this example we see that we created 2 patterns, P1 and P2. P1 can be seen as green and
the other as yellow.
We at each point ensure that we only take edges that have not been taken before. And we
find two different paths. After finding these paths we combine the path by looking at similar
vertices and replacing these with p2.
So we look at p1. We see here that there is a letter b. We see that P2 starts with b. So we
replace the letter b in formula P1 for the entirety of formula P2. Now we have found a euler
tour. Succes (:
Weighted graphs:
If each edge has a real-valued weight, we can call this graph weighted.
Real-value means it has a real number.
To make this problem a graphical problem we replace each junction with a vertex, and each
street with an edge where the length of the street is the weight of this edge.
Our problem translates to finding a closed walk of minimum length in this graph.
How would we solve the chinese postman problem?
By finding a Euler tour we ensure that each edge will be travelled at least once. We can use
either Hierholzer’s algorithm or Fleury’s algorithm. But we know that we can only find a Euler
tour if the degree of each vertex is even.
Let’s say we have a graph G, we will add a new edge to each vertex where there is an odd
degree until each vertex has an even degree. Now for this newly constructed graph we can
find a Euler tour.
The concept of this problem for odd degrees is that we can pair every vertice with an odd
degree. This pairing process should happen without a problem since there is an even
number of vertices with an odd degree.
We can see in the image below that the 2nd pairing is the shortest. (total of 5)
4. Use an algorithm of your choice to find the euler tour, that’s not the point of this
example.
Hamilton cycles:
Suppose G is a simple and connected graph. A Hamilton cycle contains every vertex of G
exactly once. A graph is Hamiltonian if it has a Hamilton cycle.
How can we find a Hamilton cycle?
Brute force.
Select a vertex v, and explore all possible paths from v until you find a Hamilton cycle.
This could take an exponential amount of time, in relation to the number of vertices.
Here is an example:
Dirac’s criterion:
So basically if G has at least 3 vertices and each vertice it’s degree is at least n/2 then G is
Hamiltonian.
Posa rotational transformations:
We start from an arbitrary selected vertex u and randomly select vertices that are adjacent
and unvisited to u and keep doing this for every next vertex until we reach a point where we
cannot go to a next vertex.
This algorithm states that then we’re going to backtrack a bit and reach the last vertex we
ended up at earlier and go back a different way. This is hard to explain without an image so
view this:
As you can see we started going from u→v→x→ ..→ w
But now we go from u→v→ w→ ...→ x and we’re going to look if we can further explore the
graph from X.
Traveling Salesman Problem (TSP):
In this slide it is asking for the “best” cycle, he’s referring to the one with the minimum
weight.
Greedy algorithm:
Start with an arbitrary cycle. Then swap edges if it reduces the overall weight. Keep doing
this.
Hamilton cycles in weighted digraphs:
So what we can see happening is that we translate our graph to a graph where for each
vertex we add a uin and a uout. Each edge has a weight of 0 (equivalent to the same weight in
the digraph). We can see that the graph below has a Hamilton cycle so the upper graph has
one as well.