In this lecture, we will
- Learn the definition of a graph and different types of graphs we will use.
- Learn what is an adjacency matrix and use it.
- Learn the following graph metrics: connected components , degree distribution , path lengths , shortest paths , diameter , average distance , clustering coefficient , and modularity .
- Learn how these graph metrics capture real-world notions about networks.
I. Graph Model
A graph $G=(V,E)$ is a tuple of two sets $V$ and $E$, where
- $V$ is a set of nodes or vertices .
- $E$ is a set of edges or links representing relationships between the nodes in $V$. Each element of this set is either
- a set $\{ i,j\}$ if the edge is undirected (as a set does not describe any order between the two vertices, so $\{ i,j\}\in E$ implies $\{ i,j\} =\{ j,i\} \in E)$;
- a tuple $(i,j)$, if the edge is directed from $i$ to $j$ (thus $(i,j)\in E$ does not imply $(j,i)\in E$).
For example, a transportation network of cities and roads connecting the cities is a graph. In this case, cities are nodes in the graph and the roads connecting the cities are the edges in the graph.
In this module on network analysis we will learn some basic properties of different types of graphs . These properties will help us analyze network data and make sense of such data.
Graph types
- A (directed) walk in a graph is a sequence of (directed) edges $(e_1,e_2,\ldots ,e_ k)$ such that every pair $(e_ i,e_{i+1})$ of edges shares a node, $v_ i$. The node (or vertex) sequence of this walk, $(v_0, v_1, \ldots , v_ k)$, is such that every pair $(v_{i-1}, v_ i)$ of nodes are connected by the (directed) edge $e_ i$.
- A (directed) trail is a walk where every edge in the sequence is unique.
- A (directed) path is a trail where every node in the node sequence is unique.
- A (directed) cycle is a (directed) trail that starts and terminates at the same node and such that all other nodes in the node sequence are unique.
Simple network |
Undirected network with at most one edge between any pair of vertices, and no self-loops. |
Multigraph |
May contain self-loops or multiple links between vertices. |
Weighted network |
Edges have weights or vertices have attributes. |
Tree |
A graph with no cycles. |
Acyclic network |
Graph with no directed cycles. |
Bipartite |
Vertices can be divided into two classes where there are no edges between vertices in the same class (but there can exist edges between vertices in different classes). |
Hypergraph |
Generalized edges which connect more than two vertices together. |
II. Adjacency Matrix
Definition of the adjacency matrix