0% found this document useful (0 votes)
78 views37 pages

Netwirks and Graphs

Summary of all about networks and graphs

Uploaded by

RekhaBhandari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views37 pages

Netwirks and Graphs

Summary of all about networks and graphs

Uploaded by

RekhaBhandari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Vertices:

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.

What were all of the symbols used again?


Kappa g: vertex cut
Lambda g: edge cut
Delta g: highest degree
X g: vertex colouring
X’ g: edge colouring

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.

Algorithm to check isomorphism:


Graph is not isomorphic if:
Amount of vertices or edges is not equal.
The ordered degree of sequence of G is different from the ordered sequence of H.

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.

Paths & Walks:


Walks: When you start from v1 and go to vk and reach the last vk by traversing the last
edge. Going double on edges is allowed.
Paths: Only distinct vertices are allowed. So double edges in the travel is not allowed.
Look below too:
Simple graph cyclic vs acrylic:
Connectivity:
Two vertices u,v, in G are connected if there is a path from u to v in G.
G is connected if all pairs of vertices are connected.
This is an equivalence relation, so its reflexive, symmetric and transitive.

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:

1,2,3,4,5 is a component and 6,7,8,9 is a component.


But not 1,2,3 because the component goes on further with 4 and 5. You cannot leave these
out. It's all or nothing. NO BULLYING

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.

Minimum number of cuts:


κ(𝐺)= Minimum number of vertices that we need to delete in order to disconnect G.
λ(𝐺)= Minimum number of edges that we need to delete in order to disconnect G.

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>,

See example below.


Example:

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

in the following path:


We can only find 1 vertex independent path of (1,7) since we always have to go through
vertex 3 and 6. You cannot avoid them so there is only one path.
Edge independent:
A path is edge independent if the paths do not share any edges. In the above example it
would be 2

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

The same goes for an edge cut:


The minimum size of an edge cut disconnecting vertices u and v equals the maximum size
of an edge-independent set P(u,v). The same reasoning goes for this since we’d still be able
to take the maximum amount of possible edge routes if we’d start cutting. Knife emoj.

Complete graph with n-vertices:


Bipartite graphs:
Graph G is bipartite if V(G) or the set of vertices of G can be partitioned into two subsets
V1 U V2 such that:
- V1 ∧ V2 = ⊘ , a.k.a there is no overlap between V1 and V2
- Any edge of G must join one vertex of V1 to a vertex of V2 . This means the edges of
the vertices in V1 and V2 should only go to each other and not to any vertices within
this subset.
Ranked embedding:
This is a method to find out if any graph is a bipartite graph:
Let G be a partite graph. Pick any vertex of G.

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.

Ranked embedding theorem & proof:

We have to prove that all vertices are either in v1 or in v2.


Planar graph:
A simple and connected graph is planar if there exists a drawing in the 2D plane such that
no two edges cross. A plane graph is such a drawing.

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.

5 vertices is not a planar graph.


Every planar graph partitions the graph into regions. Each region is either a bounded region
or an unbounded region.

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

Example for no fucking reason for this useless formula:

Proof I dont care about:


More proof that I dont care about:

Theorem for planar graphs:

Proof we dont care about:


Random question time:

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

the out degree is the number of arcs with tail v.


Theorem:

Sum of indegrees must be equal to sum of outdegrees and both must be equal to the
number of arcs.

Adjacency matrix for directed graphs:

- 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.

So we write 1 if the vertex is the tail of the arc.


We write -1 if the head and otherwise 0. We cannot capture loops.

Directed paths , walks and cycles:


Walk:
Example:

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.

Strongly connected digraph:


For every part of the digraph it needs to be strongly connected.
In the above graph it is not strongly connected because there is only 1 path from 1->5
without going through already visited arcs.
Reachability:

Vertex v is reachable from vertex u if there exists a directed (u,v) path.

Strongly connected orientations:


An orientation D(G) of a simple graph G is a digraph in which each edge from G has been
assigned a direction. So if we would have an undirected graph G and I would replace every
edge with a directed arc we would get an orientation of the graph G.

How many orientations exist for a simple graph with m edges?


2m edges. Because each edge can be placed in 2 different orientations.

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.

Edge chromatic number:


χ'(𝐺) 𝑖𝑠 𝑡ℎ𝑒 𝑚𝑖𝑛𝑖𝑚𝑢𝑚 𝑘 𝑓𝑜𝑟 𝑤ℎ𝑖𝑐ℎ 𝐺 𝑖𝑠 𝑘 − 𝑒𝑑𝑔𝑒 𝑐𝑜𝑙𝑜𝑢𝑟𝑎𝑏𝑙𝑒.
The minimum number of colours that we can colour the edges of G.
Maximum degree of vertex in graph G:

So we can see that the amount of colours will be equal or bigger than the maximum degree
in G.

Theorem:

So it is either equal to the maximum degree of a vertex in G or +1 of this maximum degree.

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.

Vertex colouring of planar graphs:

For any planar graph G, 𝑋(𝐺) ≤ 4.


This means that any map of countries can be coloured with only four different colours.

Can we cross each bridge only once?

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:

Is a closed walk that traverses all edges.

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.

In an euler trail, the start and end can be different.

Euler tour theorem:

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.

The algorithm picks a trail the following way:


- Initially the trail, let’s call this P, consists out of a single vertex u.
- As long as we have not reached an euler tour we take the following steps:
- Let v be the last added vertex, we can choose any edge that connects v and
add it to our current trail AS LONG AS this is not a cut edge. If it is a cut edge,
we first check if there are other options and if so pick those. If the only option
is a cut edge we are allowed to add it to our trail. MAKE SURE YOU BULLY
CUT EDGES. PICK THEM LAST!!
In the end you get a tour.
Corollary:

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:

Hierholzer’s algorithm is much more efficient.

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.

See example on next page.


Example:

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.

Chinese postman problem:

We can envision the problem like this:


A postman wants to pass all streets at least once but wants to travel the minimal distance.

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.

So how do we solve it for graphs where vertices have odd degrees?

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.

To insert these edges we use the following observation:


Each graph has an even number of vertices with an odd degree.

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 find the following algorithm:

I will go through the steps and an example will follow:

1. First we collect all the vertices which have an odd degree.


2. [USELESS NOTE, THIS STEP HAS A WORST-CASE TIME COMPLEXITIY OF
O(K3), USING WEIGHTED MATCHING ALGORITHM. Not very efficient basically.]
Now we create a sub-graph for this and we make an overview of the shortest paths
from one vertice to another so that each vertice has been reached and paired up.
a. Now that we have created a subgraph that is fully interconnected we have to
find the pairs we want to work with. For this the condition should hold that the
pairs are not adjacent to each other.
b. The second is that these paths should be minimum. The adjacent
requirement can be easily viewed but for the weight we’re going to have to go
through each pairing and see which pairing creates the lowest weight. We will
pick the ones with the lowest weight.
3. We will duplicate the edges that we picked in step 2 into our actual graph since we
have found the optimal way to find it. With duplicating we literally mean add extra
edges in between the vertices so that we can follow this path.
4. After doing this the degree of each vertex will be even and we can find a euler tour
using the algorithms we know. But we know that chinese postman algorithm made-up
some edges by duplicating them. In reality we cannot simply duplicate edges. This
means that the edges that were duplicated will not be duplicated but traversed twice.
The duplication is simply done to make it possible to find a euler tour.
You might wonder: “But what the actual fuck?? This is not a euler tour anymore
because we visit the edges twice??”, ok shut up and listen. In theory we add these
edges and find a euler tour for this graph only by adding these edges and having
duplicate edges. Otherwise we can't find a euler tour. But when we translate it back
into reality, to be able to visit each street a minimal amount of time as a postman, the
duplicate edges collapse back into the streets they represent and just represent 1
street.
Don't overthink it. Postman just wants to be fast.

Example of Chinese postman algorithm:

We have the following graph:

1. Collection of all the vertices with an odd degree; v1,v2,v3, and v4


2. We create a sub-graph with the pairing of these vertices and weighted edges.

a. We make an overview of their paths and pick the shortest ones:

We can see in the image below that the 2nd pairing is the shortest. (total of 5)

3. Now we duplicate these edges onto our graph:

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.

What can we figure out?


We can figure out if a graph is NOT a Hamiltonian graph.Because the following theorem
states that:
If G is Hamiltonian, and we create a subset V*. When we do G-V* the number of resulting
components of this always has to be bigger than the size of the subset V*.

Here is an example:

We can see that we created a subset with the vertices 2 and 4.


When subtracting this from G we see that we have 3 components. This is a higher number
than 2 and for this reason it is not Hamiltonian.

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.

What is this useful for?

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 how would this work if we have a directed graph?


Suppose we have a digraph D. We can pretend like digraph D is actually graph G (so we
temporarily remove the directions).

Then we apply the following steps on it:

I will show an example to show what this means:


We want to find a hamilton cycle on the following digraph:

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy