School of Information Sciences University of Pittsburgh TELCOM2125: Network Science and Analysis Konstantinos Pelechrinis Spring 2015.

Slides:



Advertisements
Similar presentations
Cpt S 223 – Advanced Data Structures Graph Algorithms: Introduction
Advertisements

Graph-02.
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture10.
CS 206 Introduction to Computer Science II 03 / 27 / 2009 Instructor: Michael Eckmann.
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
Introduction This chapter explores graphs and their applications in computer science This chapter explores graphs and their applications in computer science.
Edited by Malak Abdullah Jordan University of Science and Technology Data Structures Using C++ 2E Chapter 12 Graphs.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
CS 206 Introduction to Computer Science II 11 / 11 / Veterans Day Instructor: Michael Eckmann.
1 Representing Graphs. 2 Adjacency Matrix Suppose we have a graph G with n nodes. The adjacency matrix is the n x n matrix A=[a ij ] with: a ij = 1 if.
Graph & BFS.
Chapter 9 Graph algorithms. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Graph COMP171 Fall Graph / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D E A C F B Vertex Edge.
Graph & BFS Lecture 22 COMP171 Fall Graph & BFS / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
CSE 321 Discrete Structures Winter 2008 Lecture 25 Graph Theory.
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
CS 206 Introduction to Computer Science II 03 / 30 / 2009 Instructor: Michael Eckmann.
TELCOM2125: Network Science and Analysis
GRAPH Learning Outcomes Students should be able to:
Graphs CS /02/05 Graphs Slide 2 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Definition.
Lecture 13 Graphs. Introduction to Graphs Examples of Graphs – Airline Route Map What is the fastest way to get from Pittsburgh to St Louis? What is the.
Computer Science 112 Fundamentals of Programming II Introduction to Graphs.
Graphs. What is a graph? A data structure that consists of a set of nodes (vertices) and a set of edges that relate the nodes to each other The set of.
 What is a graph? What is a graph?  Directed vs. undirected graphs Directed vs. undirected graphs  Trees vs graphs Trees vs graphs  Terminology: Degree.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Vertices and Edges Introduction to Graphs and Networks Mills College Spring 2012.
Based on slides by Y. Peng University of Maryland
ITEC 2620A Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: 2620a.htm Office: TEL 3049.
COSC 2007 Data Structures II Chapter 14 Graphs I.
Graphs A graphs is an abstract representation of a set of objects, called vertices or nodes, where some pairs of the objects are connected by links, called.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Graphs. Introduction Graphs are a collection of vertices and edges Graphs are a collection of vertices and edges The solid circles are the vertices A,
Graph Theory. undirected graph node: a, b, c, d, e, f edge: (a, b), (a, c), (b, c), (b, e), (c, d), (c, f), (d, e), (d, f), (e, f) subgraph.
Basic Graph Algorithms Programming Puzzles and Competitions CIS 4900 / 5920 Spring 2009.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Design and Analysis of Algorithms Introduction to graphs, representations of a graph Haidong Xue Summer 2012, at GSU.
Graph Representations And Traversals. Graphs Graph : – Set of Vertices (Nodes) – Set of Edges connecting vertices (u, v) : edge connecting Origin: u Destination:
School of Information Sciences University of Pittsburgh TELCOM2125: Network Science and Analysis Konstantinos Pelechrinis Spring 2013 Figures are taken.
Lecture 20. Graphs and network models 1. Recap Binary search tree is a special binary tree which is designed to make the search of elements or keys in.
CS 201: Design and Analysis of Algorithms
Applied Discrete Mathematics Week 14: Trees
Graphs Representation, BFS, DFS
CSE 373 Topological Sort Graph Traversals
Network analysis.
Degree and Eigenvector Centrality
Network Science: A Short Introduction i3 Workshop
Graphs Representation, BFS, DFS
Graph Theory.
Graphs All tree structures are hierarchical. This means that each node can only have one parent node. Trees can be used to store data which has a definite.
Graphs Chapter 11 Objectives Upon completion you will be able to:
Chapter 9: Graphs Basic Concepts
Graph Operations And Representation
Connectivity Section 10.4.
Graph Theory By Amy C. and John M..
Graphs.
ITEC 2620M Introduction to Data Structures
Graphs By Rajanikanth B.
Graphs G = (V, E) V are the vertices; E are the edges.
GRAPHS G=<V,E> Adjacent vertices Undirected graph
GRAPHS Lecture 17 CS 2110 — Spring 2019.
Applied Discrete Mathematics Week 13: Graphs
Chapter 9: Graphs Basic Concepts
Chapter 9 Graph algorithms
GRAPHS.
Introduction to Graphs
For Friday Read chapter 9, sections 2-3 No homework
Presentation transcript:

School of Information Sciences University of Pittsburgh TELCOM2125: Network Science and Analysis Konstantinos Pelechrinis Spring 2015

A quick tutorial on igraph 2

igraph igraph is an open source collection of libraries for network analysis  Supports: R, python and C Disclaimer: This tutorial is a very basic tutorial that serves only as an introduction to igraph  We will focus our descriptions on R, but the usage of the library is very similar to other platforms 3

Network representation There are many various ways to represent a network  Most “popular” Adjacency matrix Edgelist Adjacency list Adjacency matrix representation is good for mathematical derivations but it is not very efficient for computations especially if networks are sparse  In a sparse network most of the entries of the matrix will be 0 4

Network representation Edgelist  Store the edges of a network in a tuple format  For example,

Network representation Adjacency list  Easier to work if network is large and sparse  There is one line for every node in the network that includes the IDs of the nodes he is connected to  For example, the previous network in adjacency list formaet would be: 6 1: 2,5 2: 1,3,4 3: 2,4,5,6 4: 2,3 5: 1,3 6: 3

Network representation igraph supports multiple network representations  Details of the actual format (e.g., punctuation etc.) might be different for different network libraries However, the main format will be the same Assuming that we have the previous network in an edgelist we can “read” it in igraph > library(igraph) > g <- read.graph("sample_net",format="ncol”,directed=F) 7

Network representation The network has been read an undirected (UN) and it has 6 nodes and 7 edges  V(g) gives the nodes of the network  E(g) gives the edges of the network 8 > g IGRAPH UN attr: name (v/c) > V(g) Vertex sequence: [1] "1" "2" "5" "3" "4" "6" > E(g) Edge sequence: [1] [2] [3] [4] [5] [6] [7]

Network representation You can also get the adjacency matrix 9 > m <-get.adjacency(g) 6 x 6 sparse Matrix of class "dgCMatrix"

Visualize the network 10 > plot(g) plot provides a simple network visualization  There are more advanced libraries that give more control on the way the network is visualized

Connectance The argument loops dictates whether to allow loop edges in the graph or not  If it is true self-edges are considered possible 11 > graph.density(g,loops=F) [1] > graph.density(g,loops=T) [1]

Node degree This provides a list with the degree of every node in the network 12 > degree(g)

Paths shortest.paths provides the length of the shortest path between any two nodes in g If you want to get the actual paths (and not just their length) you can use the function get.shortest.paths 13 > shortest.paths(g)

Paths We can also get the number of paths of a given length between two nodes by utilizing the adjacency matrix 14 > m%*%m 6 x 6 sparse Matrix of class "dgCMatrix"

Random graphs 15 > g=erdos.renyi.game(1000,0.1,type=“gnp”) > g IGRAPH U Erdos renyi (gnp) graph + attr: name (g/c), type (g/c), loops (g/x), p (g/n) > hist(degree(g))

Random graphs n=50 and p=

Random graphs n=50 and p=

Random graphs n=50 and p=

Random graphs 19 > for (p in 0:100){ g=erdos.renyi.game(50,p/100,"gnp") s[p+1]=max(clusters(g)$csize)/50 } plot(s, xlab="p", ylab="Giant component fraction”) lines(s)