igraph can handle multi-graphs: V = {A, B, C, D, E} E = ((AB),(AB),(AC),(BC),(CE)). igraph can handle loop-edges: V = {A, B, C, D, E} E = ((AA),(AB),(AC),(BC),
Create Undirected and Directed Graphs
To manually create a graph, the function “graph.formula” can be used.
To make it more understandable for creating directed graphs, I proposed an airport network consisting of three airports: JFK (New York City airport), PEK (Beijing airport), and CDG (Paris airport).
Thus, the directed graph that I created can be read: we only have one-way flights .
,
Get Basic Info of The Graphs
To make the blog concise, the rest of the demo will only focus on undirected graphs.
For more reference, please visit the book’s GitHub repository.
A graph, represented by G = (V, E), is a mathematical structure consisting of a set V of vertices and a set E of edges.
The number of vertices and the number of edges in the graph are sometimes called t.
,
How does rote memorization help igraph and graph production?
Rote memorization will speed the use of igraph and graph production.
The first line identifies the object as an igraph graph and then there is 4 character letter-based code.
The first character is assigned either a “D” or a “U” which indicates whether the graph is directed or undirected.
,
How many igraph functions are there?
igraph contains 773 functions.
Three different plotting mechanisms exist:
- igraph for two dimensional plots
- tkplot for interactive 2-dimensional plotting and rglplot which is for 3-dimensional plotting and is labeled as “experimental
” The igraph functions for two dimensional plots is the focus for the next * chapters.
,
Label The Vertices
I made the graph whose vertices were labeled with numbers 1 through N.
In practice, you might already have natural labels, such as names.
So here is how you could label your vertices and how it would look like:
,
Operations on Graphs
In practice, we might want to remove certain edges or join graphs to get subgraphs.
In this case, the math operators can help you achieve the goal.
The graph in (1, 1) is the original graph.
The graph in (1, 1) removed two vertices from the original graph.
The graph in (2, 1) is made of certain edges (the edges were removed from the original graph .
,
Representations For Graphs
Normally, the graph will be stored in three basic formats: adjacency lists, edge lists, and adjacency matrix (Kolaczyk et al., 2014).
An adjacency list is a collection of unordered lists.
Each unordered list describes the set of neighbors of a specific vertex in the graph within an adjacency list.
This format is what igraph uses in the graph summar.
,
What are the igraph functions for two dimensional plots?
The igraph functions for two dimensional plots is the focus for the next * chapters.
The simple graph below was created from manual entry using igraph’s graph_from_literal function.
,
What is igraph in R?
The central package is igraph, which provides extensive capabilities for studying network graphs in R.
The new edition of this book includes ,an overhaul to recent changes in igraph.