# Practical statistical network analysis (with R and igraph)

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Practical statistical network analysis (with R and igraph) Gábor Csárdi Department of Biophysics, KFKI Research Institute for Nuclear and Particle Physics of the Hungarian Academy of Sciences, Budapest, Hungary Currently at Department of Medical Genetics, University of Lausanne, Lausanne, Switzerland

2 What is a network (or graph)? Practical statistical network analysis WU Wien 2

3 What is a network (or graph)? Practical statistical network analysis WU Wien 3

4 What is a network (or graph)? Practical statistical network analysis WU Wien 4

5 What is a graph? Binary relation (=edges) between elements of a set (=vertices).

6 What is a graph? Binary relation (=edges) between elements of a set (=vertices). E.g. vertices = {A, B, C, D, E} edges = ({A, B}, {A, C}, {B, C}, {C, E}).

7 What is a graph? Binary relation (=edges) between elements of a set (=vertices). E.g. vertices = {A, B, C, D, E} edges = ({A, B}, {A, C}, {B, C}, {C, E}). It is better to draw it: E D C A B

8 What is a graph? Binary relation (=edges) between elements of a set (=vertices). E.g. vertices = {A, B, C, D, E} edges = ({A, B}, {A, C}, {B, C}, {C, E}). It is better to draw it: E C A B D E C B A D Practical statistical network analysis WU Wien 5

9 Undirected and directed graphs If the pairs are unordered, then the graph is undirected: B vertices = {A, B, C, D, E} A C E edges = ({A, B}, {A, C}, {B, C}, {C, E}). D

10 Undirected and directed graphs If the pairs are unordered, then the graph is undirected: B vertices = {A, B, C, D, E} A C E edges = ({A, B}, {A, C}, {B, C}, {C, E}). D Otherwise it is directed: B vertices = {A, B, C, D, E} A C E edges = ((A, B), (A, C), (B, C), (C, E)). D Practical statistical network analysis WU Wien 6

11 The igraph package For classic graph theory and network science. Core functionality is implemented as a C library. High level interfaces from R and Python. GNU GPL. Practical statistical network analysis WU Wien 7

12 Vertex and edge ids Vertices are always numbered from zero (!). Numbering is continual, form to V.

13 Vertex and edge ids Vertices are always numbered from zero (!). Numbering is continual, form to V. We have to translate vertex names to ids: V = {A, B, C, D, E} E = ((A, B), (A, C), (B, C), (C, E)). A =, B =, C = 2, D = 3, E = 4.

14 Vertex and edge ids Vertices are always numbered from zero (!). Numbering is continual, form to V. We have to translate vertex names to ids: V = {A, B, C, D, E} E = ((A, B), (A, C), (B, C), (C, E)). A =, B =, C = 2, D = 3, E = 4. > g <- graph( c(,,,2,,2, 2,4), n=5 ) Practical statistical network analysis WU Wien 8

15 Creating igraph graphs igraph objects

16 Creating igraph graphs igraph objects print(), summary(), is.igraph()

17 Creating igraph graphs igraph objects print(), summary(), is.igraph() is.directed(), vcount(), ecount() > g <- graph( c(,,,2,,2, 2,4), n=5 ) 2 > g 3 Vertices: 5 4 Edges: 4 5 Directed: TRUE 6 Edges: 7 8 [] -> 9 [] -> 2 [2] -> 2 [3] 2 -> 4 Practical statistical network analysis WU Wien 9

18 Visualization > g <- graph.tree(4, 4) 2 > plot(g) 3 > plot(g, layout=layout.circle)

19 Visualization > g <- graph.tree(4, 4) 2 > plot(g) 3 > plot(g, layout=layout.circle) # Force directed layouts 2 > plot(g, layout=layout.fruchterman.reingold) 3 > plot(g, layout=layout.graphopt) 4 > plot(g, layout=layout.kamada.kawai)

20 Visualization > g <- graph.tree(4, 4) 2 > plot(g) 3 > plot(g, layout=layout.circle) # Force directed layouts 2 > plot(g, layout=layout.fruchterman.reingold) 3 > plot(g, layout=layout.graphopt) 4 > plot(g, layout=layout.kamada.kawai) # Interactive 2 > tkplot(g, layout=layout.kamada.kawai) 3 > l <- layout=layout.kamada.kawai(g)

21 Visualization > g <- graph.tree(4, 4) 2 > plot(g) 3 > plot(g, layout=layout.circle) # Force directed layouts 2 > plot(g, layout=layout.fruchterman.reingold) 3 > plot(g, layout=layout.graphopt) 4 > plot(g, layout=layout.kamada.kawai) # Interactive 2 > tkplot(g, layout=layout.kamada.kawai) 3 > l <- layout=layout.kamada.kawai(g) # 3D 2 > rglplot(g, layout=l)

22 Visualization > g <- graph.tree(4, 4) 2 > plot(g) 3 > plot(g, layout=layout.circle) # Force directed layouts 2 > plot(g, layout=layout.fruchterman.reingold) 3 > plot(g, layout=layout.graphopt) 4 > plot(g, layout=layout.kamada.kawai) # Interactive 2 > tkplot(g, layout=layout.kamada.kawai) 3 > l <- layout=layout.kamada.kawai(g) # 3D 2 > rglplot(g, layout=l) # Visual properties 2 > plot(g, layout=l, vertex.color="cyan") Practical statistical network analysis WU Wien

23 Simple graphs igraph can handle multi-graphs: V = {A, B, C, D, E} E = ((AB), (AB), (AC), (BC), (CE)). > g <- graph( c(,,,,,2,,2, 3,4), n=5 ) 2 > g 3 Vertices: 5 4 Edges: 5 5 Directed: TRUE 6 Edges: 7 8 [] -> 9 [] -> [2] -> 2 [3] -> 2 2 [4] 3 -> 4 Practical statistical network analysis WU Wien

24 Simple graphs igraph can handle loop-edges: V = {A, B, C, D, E} E = ((AA), (AB), (AC), (BC), (CE)). > g <- graph( c(,,,,,2,,2, 3,4), n=5 ) 2 > g 3 Vertices: 5 4 Edges: 5 5 Directed: TRUE 6 Edges: 7 8 [] -> 9 [] -> [2] -> 2 [3] -> 2 2 [4] 3 -> 4 Practical statistical network analysis WU Wien 2

25 Creating (more) igraph graphs el <- scan("lesmis.txt") 2 el <- matrix(el, byrow=true, nc=2) 3 gmis <- graph.edgelist(el, dir=false) 4 summary(gmis) Practical statistical network analysis WU Wien 3

26 Naming vertices V(gmis)\$name 2 g <- graph.ring() 3 V(g)\$name <- sample(letters, vcount(g)) Practical statistical network analysis WU Wien 4

27 Creating (more) igraph graphs # A simple undirected graph 2 > g <- graph.formula( Alice-Bob-Cecil-Alice, 3 Daniel-Cecil-Eugene, Cecil-Gordon )

28 Creating (more) igraph graphs # A simple undirected graph 2 > g <- graph.formula( Alice-Bob-Cecil-Alice, 3 Daniel-Cecil-Eugene, Cecil-Gordon ) # Another undirected graph, ":" notation 2 > g2 <- graph.formula( Alice-Bob:Cecil:Daniel, 3 Cecil:Daniel-Eugene:Gordon )

29 Creating (more) igraph graphs # A simple undirected graph 2 > g <- graph.formula( Alice-Bob-Cecil-Alice, 3 Daniel-Cecil-Eugene, Cecil-Gordon ) # Another undirected graph, ":" notation 2 > g2 <- graph.formula( Alice-Bob:Cecil:Daniel, 3 Cecil:Daniel-Eugene:Gordon ) # A directed graph 2 > g3 <- graph.formula( Alice +-+ Bob --+ Cecil Daniel, Eugene --+ Gordon:Helen )

30 Creating (more) igraph graphs # A simple undirected graph 2 > g <- graph.formula( Alice-Bob-Cecil-Alice, 3 Daniel-Cecil-Eugene, Cecil-Gordon ) # Another undirected graph, ":" notation 2 > g2 <- graph.formula( Alice-Bob:Cecil:Daniel, 3 Cecil:Daniel-Eugene:Gordon ) # A directed graph 2 > g3 <- graph.formula( Alice +-+ Bob --+ Cecil Daniel, Eugene --+ Gordon:Helen ) # A graph with isolate vertices 2 > g4 <- graph.formula( Alice -- Bob -- Daniel, 3 Cecil:Gordon, Helen )

31 Creating (more) igraph graphs # A simple undirected graph 2 > g <- graph.formula( Alice-Bob-Cecil-Alice, 3 Daniel-Cecil-Eugene, Cecil-Gordon ) # Another undirected graph, ":" notation 2 > g2 <- graph.formula( Alice-Bob:Cecil:Daniel, 3 Cecil:Daniel-Eugene:Gordon ) # A directed graph 2 > g3 <- graph.formula( Alice +-+ Bob --+ Cecil Daniel, Eugene --+ Gordon:Helen ) # A graph with isolate vertices 2 > g4 <- graph.formula( Alice -- Bob -- Daniel, 3 Cecil:Gordon, Helen ) # "Arrows" can be arbitrarily long 2 > g5 <- graph.formula( Alice Bob ) Practical statistical network analysis WU Wien 5

32 Vertex/Edge sets, attributes Assigning attributes: set/get.graph/vertex/edge.attribute.

33 Vertex/Edge sets, attributes Assigning attributes: set/get.graph/vertex/edge.attribute. V(g) and E(g).

34 Vertex/Edge sets, attributes Assigning attributes: set/get.graph/vertex/edge.attribute. V(g) and E(g). Smart indexing, e.g. V(g)[color=="white"]

35 Vertex/Edge sets, attributes Assigning attributes: set/get.graph/vertex/edge.attribute. V(g) and E(g). Smart indexing, e.g. V(g)[color=="white"] Easy access of attributes: > g <- erdos.renyi.game(, /) 2 > V(g)\$color <- sample( c("red", "black"), 3 vcount(g), rep=true) 4 > E(g)\$color <- "grey" 5 > red <- V(g)[ color == "red" ] 6 > bl <- V(g)[ color == "black" ] 7 > E(g)[ red %--% red ]\$color <- "red" 8 > E(g)[ bl %--% bl ]\$color <- "black" 9 > plot(g, vertex.size=5, layout= layout.fruchterman.reingold) Practical statistical network analysis WU Wien 6

36 Creating (even) more graphs E.g. from.csv files. > traits <- read.csv("traits.csv", head=f) 2 > relations <- read.csv("relations.csv", head=f) 3 > orgnet <- graph.data.frame(relations) 4 5 > traits[,] <- sapply(strsplit(as.character 6 (traits[,]), split=" "), "[[", ) 7 > idx <- match(v(orgnet)\$name, traits[,]) 8 > V(orgnet)\$gender <- as.character(traits[,3][idx]) 9 > V(orgnet)\$age <- traits[,2][idx] > igraph.par("print.vertex.attributes", TRUE) 2 > orgnet Practical statistical network analysis WU Wien 7

37 Creating (even) more graphs From the web, e.g. Pajek files. > karate <- read.graph(" 2 format="pajek") 3 > summary(karate) 4 Vertices: 34 5 Edges: 78 6 Directed: FALSE 7 No graph attributes. 8 No vertex attributes. 9 No edge attributes. Practical statistical network analysis WU Wien 8

38 Graph representation There is no best format, everything depends on what kind of questions one wants to ask. Iannis Esmeralda Fabien Alice Diana Helen Cecil Jennifer Gigi Bob Practical statistical network analysis WU Wien 9

39 Graph representation Adjacency matrix. Good for questions like: is Alice connected to Bob? Alice Bob Cecil Diana Esmeralda Fabien Gigi Helen Iannis Jennifer Alice Bob Cecil Diana Esmeralda Fabien Gigi Helen Iannis Jennifer Practical statistical network analysis WU Wien 2

40 Graph representation Edge list. Not really good for anything. Alice Bob Cecil Alice Diana Cecil Esmeralda Bob Cecil Diana Alice Bob Diana Esmeralda Fabien Gigi Diana Esmeralda Alice Helen Bob Diana Diana Esmeralda Esmeralda Fabien Fabien Gigi Gigi Gigi Helen Helen Helen Helen Helen Helen Iannis Iannis Jennifer Jennifer Practical statistical network analysis WU Wien 2

41 Graph representation Adjacency lists. GQ: who are the neighbors of Alice? Alice Bob Cecil Diana Esmeralda Fabien Gigi Helen Iannis Jennifer Bob, Esmeralda, Helen, Jennifer Alice, Diana, Gigi, Helen Diana, Fabien, Gigi Bob, Cecil, Esmeralda, Gigi, Helen, Iannis Alice, Diana, Fabien, Helen, Iannis Cecil, Esmeralda, Helen Bob, Cecil, Diana, Helen Alice, Bob, Diana, Esmeralda, Fabien, Gigi, Jennifer Diana, Esmeralda Alice, Helen Practical statistical network analysis WU Wien 22

42 Graph representation igraph. Flat data structures, indexed edge lists. Easy to handle, good for many kind of questions. Practical statistical network analysis WU Wien 23

43 Centrality in networks degree Iannis 2 Esmeralda 5 Cecil 3 Fabien 3 Diana 6 Gigi 4 Helen 7 Bob 4 Alice 4 Jennifer 2 Practical statistical network analysis WU Wien 24

44 Centrality in networks closeness C v = V i v d vi Iannis.53 Esmeralda.69 Cecil.53 Fabien.6 Diana.75 Gigi.64 Helen.82 Bob.64 Alice.6 Jennifer.5 Practical statistical network analysis WU Wien 25

45 Centrality in networks betweenness B v = g ivj /g ij i j,i v,j v Iannis Esmeralda 4.62 Cecil.83 Fabien.45 Diana 6.76 Gigi.45 Helen. Bob.2 Alice.67 Jennifer Practical statistical network analysis WU Wien 26

46 Centrality in networks eigenvector centrality E v = λ V i= A iv E i, Ax = λx Iannis.36 Esmeralda.75 Cecil.46 Fabien.49 Diana.88 Gigi.68 Helen Bob.7 Alice.63 Jennifer.36 Practical statistical network analysis WU Wien 27

47 Centrality in networks page rank E v = d V + d V i= A iv E i Iannis.34 Esmeralda.74 Cecil.47 Fabien.47 Diana.87 Gigi.59 Helen Bob.59 Alice.6 Jennifer.34 Practical statistical network analysis WU Wien 28

48 Community structure in networks Organizing things, clustering items to see the structure. M. E. J. Newman, PNAS, 3, Practical statistical network analysis WU Wien 29

49 Community structure in networks How to define what is modular? Many proposed definitions, here is a popular one: Q = 2 E [A vw p vw ]δ(c v, c w ). vw

50 Community structure in networks How to define what is modular? Many proposed definitions, here is a popular one: Q = 2 E [A vw p vw ]δ(c v, c w ). vw Random graph null model: p vw = p = V ( V )

51 Community structure in networks How to define what is modular? Many proposed definitions, here is a popular one: Q = 2 E [A vw p vw ]δ(c v, c w ). vw Random graph null model: p vw = p = V ( V ) Degree sequence based null model: p vw = k vk w 2 E Practical statistical network analysis WU Wien 3

52 Cohesive blocks (Based on Structural Cohesion and Embeddedness: a Hierarchical Concept of Social Groups by J.Moody and D.White, Americal Sociological Review, 68, 3 27, 23) Definition : A collectivity is structurally cohesive to the extent that the social relations of its members hold it together.

53 Cohesive blocks (Based on Structural Cohesion and Embeddedness: a Hierarchical Concept of Social Groups by J.Moody and D.White, Americal Sociological Review, 68, 3 27, 23) Definition : A collectivity is structurally cohesive to the extent that the social relations of its members hold it together. Definition 2: A group is structurally cohesive to the extent that multiple independent relational paths among all pairs of members hold it together.

54 Cohesive blocks (Based on Structural Cohesion and Embeddedness: a Hierarchical Concept of Social Groups by J.Moody and D.White, Americal Sociological Review, 68, 3 27, 23) Definition : A collectivity is structurally cohesive to the extent that the social relations of its members hold it together. Definition 2: A group is structurally cohesive to the extent that multiple independent relational paths among all pairs of members hold it together. Vertex-independent paths and vertex connectivity.

55 Cohesive blocks (Based on Structural Cohesion and Embeddedness: a Hierarchical Concept of Social Groups by J.Moody and D.White, Americal Sociological Review, 68, 3 27, 23) Definition : A collectivity is structurally cohesive to the extent that the social relations of its members hold it together. Definition 2: A group is structurally cohesive to the extent that multiple independent relational paths among all pairs of members hold it together. Vertex-independent paths and vertex connectivity. Vertex connectivity and network flows. Practical statistical network analysis WU Wien 3

56 Cohesive blocks Practical statistical network analysis WU Wien 32

57 Cohesive blocks Practical statistical network analysis WU Wien 33

58 Rapid prototyping Weighted transitivity c(i) = A3 ii (AA) ii

59 Rapid prototyping Weighted transitivity c(i) = A3 ii (AA) ii c w (i) = W 3 ii (WW max W) ii

60 Rapid prototyping Weighted transitivity c(i) = A3 ii (AA) ii c w (i) = W 3 ii (WW max W) ii wtrans <- function(g) { 2 W <- get.adjacency(g, attr="weight") 3 WM <- matrix(max(w), nrow(w), ncol(w)) 4 diag(wm) <- 5 diag( W %*% W %*% W ) / 6 diag( W %*% WM %*% W) 7 } Practical statistical network analysis WU Wien 34

61 Rapid prototyping Clique percolation (Palla et al., Nature 435, 84, 25) Practical statistical network analysis WU Wien 35

62 ... and the rest Cliques and independent vertex sets. Network flows. Motifs, i.e. dyad and triad census. Random graph generators. Graph isomorphism. Vertex similarity measures, topological sorting, spanning trees, graph components, K-cores, transitivity or clustering coefficient. etc. C-level: rich data type library. Practical statistical network analysis WU Wien 36

63 Acknowledgement Tamás Nepusz All the people who contributed code, sent bug reports, suggestions The R project Hungarian Academy of Sciences The OSS community in general Practical statistical network analysis WU Wien 37

### Social Media Mining. Graph Essentials

Graph Essentials Graph Basics Measures Graph and Essentials Metrics 2 2 Nodes and Edges A network is a graph nodes, actors, or vertices (plural of vertex) Connections, edges or ties Edge Node Measures

### Lecture Notes on Spanning Trees

Lecture Notes on Spanning Trees 15-122: Principles of Imperative Computation Frank Pfenning Lecture 26 April 26, 2011 1 Introduction In this lecture we introduce graphs. Graphs provide a uniform model

### The igraph software package for complex network research

The igraph software package for complex network research Gábor Csárdi Center for Complex Systems Studies, Kalamazoo College, Kalamazoo, MI, USA and Department of Biophysics, KFKI Research Institute for

### DATA ANALYSIS II. Matrix Algorithms

DATA ANALYSIS II Matrix Algorithms Similarity Matrix Given a dataset D = {x i }, i=1,..,n consisting of n points in R d, let A denote the n n symmetric similarity matrix between the points, given as where

### A comparative study of social network analysis tools

Membre de Membre de A comparative study of social network analysis tools David Combe, Christine Largeron, Előd Egyed-Zsigmond and Mathias Géry International Workshop on Web Intelligence and Virtual Enterprises

### Part 2: Community Detection

Chapter 8: Graph Data Part 2: Community Detection Based on Leskovec, Rajaraman, Ullman 2014: Mining of Massive Datasets Big Data Management and Analytics Outline Community Detection - Social networks -

### Graph. Consider a graph, G in Fig Then the vertex V and edge E can be represented as:

Graph A graph G consist of 1. Set of vertices V (called nodes), (V = {v1, v2, v3, v4...}) and 2. Set of edges E (i.e., E {e1, e2, e3...cm} A graph can be represents as G = (V, E), where V is a finite and

### Homework 15 Solutions

PROBLEM ONE (Trees) Homework 15 Solutions 1. Recall the definition of a tree: a tree is a connected, undirected graph which has no cycles. Which of the following definitions are equivalent to this definition

### Complex Networks Analysis: Clustering Methods

Complex Networks Analysis: Clustering Methods Nikolai Nefedov Spring 2013 ISI ETH Zurich nefedov@isi.ee.ethz.ch 1 Outline Purpose to give an overview of modern graph-clustering methods and their applications

### SGL: Stata graph library for network analysis

SGL: Stata graph library for network analysis Hirotaka Miura Federal Reserve Bank of San Francisco Stata Conference Chicago 2011 The views presented here are my own and do not necessarily represent the

### Social Media Mining. Network Measures

Klout Measures and Metrics 22 Why Do We Need Measures? Who are the central figures (influential individuals) in the network? What interaction patterns are common in friends? Who are the like-minded users

### Chapter There are non-isomorphic rooted trees with four vertices. Ans: 4.

Use the following to answer questions 1-26: In the questions below fill in the blanks. Chapter 10 1. If T is a tree with 999 vertices, then T has edges. 998. 2. There are non-isomorphic trees with four

### 10. Graph Matrices Incidence Matrix

10 Graph Matrices Since a graph is completely determined by specifying either its adjacency structure or its incidence structure, these specifications provide far more efficient ways of representing a

### Network/Graph Theory. What is a Network? What is network theory? Graph-based representations. Friendship Network. What makes a problem graph-like?

What is a Network? Network/Graph Theory Network = graph Informally a graph is a set of nodes joined by a set of lines or arrows. 1 1 2 3 2 3 4 5 6 4 5 6 Graph-based representations Representing a problem

### CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.

Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure

### Graph/Network Visualization

Graph/Network Visualization Data model: graph structures (relations, knowledge) and networks. Applications: Telecommunication systems, Internet and WWW, Retailers distribution networks knowledge representation

### Long questions answer Advanced Mathematics for Computer Application If P= , find BT. 19. If B = 1 0, find 2B and -3B.

Unit-1: Matrix Algebra Short questions answer 1. What is Matrix? 2. Define the following terms : a) Elements matrix b) Row matrix c) Column matrix d) Diagonal matrix e) Scalar matrix f) Unit matrix OR

### 2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)

### Statistical and computational challenges in networks and cybersecurity

Statistical and computational challenges in networks and cybersecurity Hugh Chipman Acadia University June 12, 2015 Statistical and computational challenges in networks and cybersecurity May 4-8, 2015,

### Network Metrics, Planar Graphs, and Software Tools. Based on materials by Lala Adamic, UMichigan

Network Metrics, Planar Graphs, and Software Tools Based on materials by Lala Adamic, UMichigan Network Metrics: Bowtie Model of the Web n The Web is a directed graph: n webpages link to other webpages

### Electrical Resistances in Products of Graphs

Electrical Resistances in Products of Graphs By Shelley Welke Under the direction of Dr. John S. Caughman In partial fulfillment of the requirements for the degree of: Masters of Science in Teaching Mathematics

### In the following we will only consider undirected networks.

Roles in Networks Roles in Networks Motivation for work: Let topology define network roles. Work by Kleinberg on directed graphs, used topology to define two types of roles: authorities and hubs. (Each

### 3. The Junction Tree Algorithms

A Short Course on Graphical Models 3. The Junction Tree Algorithms Mark Paskin mark@paskin.org 1 Review: conditional independence Two random variables X and Y are independent (written X Y ) iff p X ( )

### Discrete Mathematics & Mathematical Reasoning Chapter 10: Graphs

Discrete Mathematics & Mathematical Reasoning Chapter 10: Graphs Kousha Etessami U. of Edinburgh, UK Kousha Etessami (U. of Edinburgh, UK) Discrete Mathematics (Chapter 6) 1 / 13 Overview Graphs and Graph

### Equivalence Concepts for Social Networks

Equivalence Concepts for Social Networks Tom A.B. Snijders University of Oxford March 26, 2009 c Tom A.B. Snijders (University of Oxford) Equivalences in networks March 26, 2009 1 / 40 Outline Structural

### CMSC 451: Graph Properties, DFS, BFS, etc.

CMSC 451: Graph Properties, DFS, BFS, etc. Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Chapter 3 of Algorithm Design by Kleinberg & Tardos. Graphs

### Tools and Techniques for Social Network Analysis

Tools and Techniques for Social Network Analysis Pajek Program for Analysis and Visualization of Large Networks Pajek: What is it Pajek is a program, for Windows and Linux (via Wine) Developers: Vladimir

### 12 Abstract Data Types

12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).

### USING SPECTRAL RADIUS RATIO FOR NODE DEGREE TO ANALYZE THE EVOLUTION OF SCALE- FREE NETWORKS AND SMALL-WORLD NETWORKS

USING SPECTRAL RADIUS RATIO FOR NODE DEGREE TO ANALYZE THE EVOLUTION OF SCALE- FREE NETWORKS AND SMALL-WORLD NETWORKS Natarajan Meghanathan Jackson State University, 1400 Lynch St, Jackson, MS, USA natarajan.meghanathan@jsums.edu

### Option 1: empirical network analysis. Task: find data, analyze data (and visualize it), then interpret.

Programming project Task Option 1: empirical network analysis. Task: find data, analyze data (and visualize it), then interpret. Obtaining data This project focuses upon cocktail ingredients. Data was

V. Adamchik 1 Graph Theory Victor Adamchik Fall of 2005 Plan 1. Basic Vocabulary 2. Regular graph 3. Connectivity 4. Representing Graphs Introduction A.Aho and J.Ulman acknowledge that Fundamentally, computer

### Network Analysis and Visualization of Staphylococcus aureus. by Russ Gibson

Network Analysis and Visualization of Staphylococcus aureus by Russ Gibson Network analysis Based on graph theory Probabilistic models (random graphs) developed by Erdős and Rényi in 1959 Theory and tools

### Graph Theory and Complex Networks: An Introduction. Chapter 06: Network analysis

Graph Theory and Complex Networks: An Introduction Maarten van Steen VU Amsterdam, Dept. Computer Science Room R4.0, steen@cs.vu.nl Chapter 06: Network analysis Version: April 8, 04 / 3 Contents Chapter

### Determining If Two Graphs Are Isomorphic 1

Determining If Two Graphs Are Isomorphic 1 Given two graphs, it is often really hard to tell if they ARE isomorphic, but usually easier to see if they ARE NOT isomorphic. Here is our first idea to help

### IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* Rakesh Nagi Department of Industrial Engineering University at Buffalo (SUNY) *Lecture notes from Network Flows by Ahuja, Magnanti

### Lesson 3. Algebraic graph theory. Sergio Barbarossa. Rome - February 2010

Lesson 3 Algebraic graph theory Sergio Barbarossa Basic notions Definition: A directed graph (or digraph) composed by a set of vertices and a set of edges We adopt the convention that the information flows

### Data Structures. Chapter 8

Chapter 8 Data Structures Computer has to process lots and lots of data. To systematically process those data efficiently, those data are organized as a whole, appropriate for the application, called a

### Practical Graph Mining with R. 5. Link Analysis

Practical Graph Mining with R 5. Link Analysis Outline Link Analysis Concepts Metrics for Analyzing Networks PageRank HITS Link Prediction 2 Link Analysis Concepts Link A relationship between two entities

### Minimum Spanning Trees

Minimum Spanning Trees Algorithms and 18.304 Presentation Outline 1 Graph Terminology Minimum Spanning Trees 2 3 Outline Graph Terminology Minimum Spanning Trees 1 Graph Terminology Minimum Spanning Trees

About the Tutorial This tutorial offers a brief introduction to the fundamentals of graph theory. Written in a reader-friendly style, it covers the types of graphs, their properties, trees, graph traversability,

### Graph Theory for Articulated Bodies

Graph Theory for Articulated Bodies Alba Perez-Gracia Department of Mechanical Engineering, Idaho State University Articulated Bodies A set of rigid bodies (links) joined by joints that allow relative

### Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit

Data Structures Page 1 of 24 A.1. Arrays (Vectors) n-element vector start address + ielementsize 0 +1 +2 +3 +4... +n-1 start address continuous memory block static, if size is known at compile time dynamic,

### Social and Economic Networks: Lecture 1, Networks?

Social and Economic Networks: Lecture 1, Networks? Alper Duman Izmir University Economics, February 26, 2013 Conventional economics assume that all agents are either completely connected or totally isolated.

### Graph definition Degree, in, out degree, oriented graph. Complete, regular, bipartite graph. Graph representation, connectivity, adjacency.

Mária Markošová Graph definition Degree, in, out degree, oriented graph. Complete, regular, bipartite graph. Graph representation, connectivity, adjacency. Isomorphism of graphs. Paths, cycles, trials.

### (a) (b) (c) Figure 1 : Graphs, multigraphs and digraphs. If the vertices of the leftmost figure are labelled {1, 2, 3, 4} in clockwise order from

4 Graph Theory Throughout these notes, a graph G is a pair (V, E) where V is a set and E is a set of unordered pairs of elements of V. The elements of V are called vertices and the elements of E are called

### Collective behaviour in clustered social networks

Collective behaviour in clustered social networks Maciej Wołoszyn 1, Dietrich Stauffer 2, Krzysztof Kułakowski 1 1 Faculty of Physics and Applied Computer Science AGH University of Science and Technology

### Graphs and Network Flows IE411 Lecture 1

Graphs and Network Flows IE411 Lecture 1 Dr. Ted Ralphs IE411 Lecture 1 1 References for Today s Lecture Required reading Sections 17.1, 19.1 References AMO Chapter 1 and Section 2.1 and 2.2 IE411 Lecture

### ! E6893 Big Data Analytics Lecture 10:! Linked Big Data Graph Computing (II)

E6893 Big Data Analytics Lecture 10: Linked Big Data Graph Computing (II) Ching-Yung Lin, Ph.D. Adjunct Professor, Dept. of Electrical Engineering and Computer Science Mgr., Dept. of Network Science and

### OPTIMAL DESIGN OF DISTRIBUTED SENSOR NETWORKS FOR FIELD RECONSTRUCTION

OPTIMAL DESIGN OF DISTRIBUTED SENSOR NETWORKS FOR FIELD RECONSTRUCTION Sérgio Pequito, Stephen Kruzick, Soummya Kar, José M. F. Moura, A. Pedro Aguiar Department of Electrical and Computer Engineering

### Linear Programming I

Linear Programming I November 30, 2003 1 Introduction In the VCR/guns/nuclear bombs/napkins/star wars/professors/butter/mice problem, the benevolent dictator, Bigus Piguinus, of south Antarctica penguins

### Bindel, Fall 2012 Matrix Computations (CS 6210) Week 8: Friday, Oct 12

Why eigenvalues? Week 8: Friday, Oct 12 I spend a lot of time thinking about eigenvalue problems. In part, this is because I look for problems that can be solved via eigenvalues. But I might have fewer

### SCAN: A Structural Clustering Algorithm for Networks

SCAN: A Structural Clustering Algorithm for Networks Xiaowei Xu, Nurcan Yuruk, Zhidan Feng (University of Arkansas at Little Rock) Thomas A. J. Schweiger (Acxiom Corporation) Networks scaling: #edges connected

### 5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

1. The advantage of.. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. [A] Lists [B] Linked Lists [A] Trees [A] Queues 2. The

### Graph theoretic approach to analyze amino acid network

Int. J. Adv. Appl. Math. and Mech. 2(3) (2015) 31-37 (ISSN: 2347-2529) Journal homepage: www.ijaamm.com International Journal of Advances in Applied Mathematics and Mechanics Graph theoretic approach to

### Solutions to Exercises 8

Discrete Mathematics Lent 2009 MA210 Solutions to Exercises 8 (1) Suppose that G is a graph in which every vertex has degree at least k, where k 1, and in which every cycle contains at least 4 vertices.

### in R Binbin Lu, Martin Charlton National Centre for Geocomputation National University of Ireland Maynooth The R User Conference 2011

Converting a spatial network to a graph in R Binbin Lu, Martin Charlton National Centre for Geocomputation National University of Ireland Maynooth Maynooth, Co.Kildare, Ireland The R User Conference 2011

### Why? A central concept in Computer Science. Algorithms are ubiquitous.

Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online

### Planarity Planarity

Planarity 8.1 71 Planarity Up until now, graphs have been completely abstract. In Topological Graph Theory, it matters how the graphs are drawn. Do the edges cross? Are there knots in the graph structure?

### GRAPH THEORY and APPLICATIONS. Trees

GRAPH THEORY and APPLICATIONS Trees Properties Tree: a connected graph with no cycle (acyclic) Forest: a graph with no cycle Paths are trees. Star: A tree consisting of one vertex adjacent to all the others.

### COT5405 Analysis of Algorithms Homework 3 Solutions

COT0 Analysis of Algorithms Homework 3 Solutions. Prove or give a counter example: (a) In the textbook, we have two routines for graph traversal - DFS(G) and BFS(G,s) - where G is a graph and s is any

### Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path.

Chapter 3 Trees Section 3. Fundamental Properties of Trees Suppose your city is planning to construct a rapid rail system. They want to construct the most economical system possible that will meet the

### Graph Theory Notes. Vadim Lozin. Institute of Mathematics University of Warwick

Graph Theory Notes Vadim Lozin Institute of Mathematics University of Warwick 1 Introduction A graph G = (V, E) consists of two sets V and E. The elements of V are called the vertices and the elements

### Graph Algorithms using Map-Reduce

Graph Algorithms using Map-Reduce Graphs are ubiquitous in modern society. Some examples: The hyperlink structure of the web 1/7 Graph Algorithms using Map-Reduce Graphs are ubiquitous in modern society.

### Network (Tree) Topology Inference Based on Prüfer Sequence

Network (Tree) Topology Inference Based on Prüfer Sequence C. Vanniarajan and Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology Madras Chennai 600036 vanniarajanc@hcl.in,

### An Introduction to APGL

An Introduction to APGL Charanpal Dhanjal February 2012 Abstract Another Python Graph Library (APGL) is a graph library written using pure Python, NumPy and SciPy. Users new to the library can gain an

### Any two nodes which are connected by an edge in a graph are called adjacent node.

. iscuss following. Graph graph G consist of a non empty set V called the set of nodes (points, vertices) of the graph, a set which is the set of edges and a mapping from the set of edges to a set of pairs

### Graph Processing and Social Networks

Graph Processing and Social Networks Presented by Shu Jiayu, Yang Ji Department of Computer Science and Engineering The Hong Kong University of Science and Technology 2015/4/20 1 Outline Background Graph

### Lattice Point Geometry: Pick s Theorem and Minkowski s Theorem. Senior Exercise in Mathematics. Jennifer Garbett Kenyon College

Lattice Point Geometry: Pick s Theorem and Minkowski s Theorem Senior Exercise in Mathematics Jennifer Garbett Kenyon College November 18, 010 Contents 1 Introduction 1 Primitive Lattice Triangles 5.1

### Graph Theory and Complex Networks: An Introduction. Chapter 06: Network analysis. Contents. Introduction. Maarten van Steen. Version: April 28, 2014

Graph Theory and Complex Networks: An Introduction Maarten van Steen VU Amsterdam, Dept. Computer Science Room R.0, steen@cs.vu.nl Chapter 0: Version: April 8, 0 / Contents Chapter Description 0: Introduction

### A comparative study of social network analysis tools

A comparative study of social network analysis tools David Combe, Christine Largeron, Elod Egyed-Zsigmond, Mathias Géry To cite this version: David Combe, Christine Largeron, Elod Egyed-Zsigmond, Mathias

### Asking Hard Graph Questions. Paul Burkhardt. February 3, 2014

Beyond Watson: Predictive Analytics and Big Data U.S. National Security Agency Research Directorate - R6 Technical Report February 3, 2014 300 years before Watson there was Euler! The first (Jeopardy!)

### Lecture 9. 1 Introduction. 2 Random Walks in Graphs. 1.1 How To Explore a Graph? CS-621 Theory Gems October 17, 2012

CS-62 Theory Gems October 7, 202 Lecture 9 Lecturer: Aleksander Mądry Scribes: Dorina Thanou, Xiaowen Dong Introduction Over the next couple of lectures, our focus will be on graphs. Graphs are one of

### Reductions & NP-completeness as part of Foundations of Computer Science undergraduate course

Reductions & NP-completeness as part of Foundations of Computer Science undergraduate course Alex Angelopoulos, NTUA January 22, 2015 Outline Alex Angelopoulos (NTUA) FoCS: Reductions & NP-completeness-

### Subgraph Patterns: Network Motifs and Graphlets. Pedro Ribeiro

Subgraph Patterns: Network Motifs and Graphlets Pedro Ribeiro Analyzing Complex Networks We have been talking about extracting information from networks Some possible tasks: General Patterns Ex: scale-free,

### RA MODEL VISUALIZATION WITH MICROSOFT EXCEL 2013 AND GEPHI

RA MODEL VISUALIZATION WITH MICROSOFT EXCEL 2013 AND GEPHI Prepared for Prof. Martin Zwick December 9, 2014 by Teresa D. Schmidt (tds@pdx.edu) 1. DOWNLOADING AND INSTALLING USER DEFINED SPLIT FUNCTION

### Graphs. Graph G=(V,E): representation

Graphs G = (V,E) V the vertices of the graph {v 1, v 2,..., v n } E the edges; E a subset of V x V A cost function cij is the cost/ weight of the edge (v i, v j ) Graph G=(V,E): representation 1. Adjacency

### Chapter 4: Trees. 2. Theorem: Let T be a graph with n vertices. Then the following statements are equivalent:

9 Properties of Trees. Definitions: Chapter 4: Trees forest - a graph that contains no cycles tree - a connected forest. Theorem: Let T be a graph with n vertices. Then the following statements are equivalent:

### COMPRESSION SPRINGS: STANDARD SERIES (INCH)

: STANDARD SERIES (INCH) LC 014A 01 0.250 6.35 11.25 0.200 0.088 2.24 F F M LC 014A 02 0.313 7.94 8.90 0.159 0.105 2.67 F F M LC 014A 03 0.375 9.52 7.10 0.126 0.122 3.10 F F M LC 014A 04 0.438 11.11 6.00

### HISTORICAL DEVELOPMENTS AND THEORETICAL APPROACHES IN SOCIOLOGY Vol. I - Social Network Analysis - Wouter de Nooy

SOCIAL NETWORK ANALYSIS University of Amsterdam, Netherlands Keywords: Social networks, structuralism, cohesion, brokerage, stratification, network analysis, methods, graph theory, statistical models Contents

### Warshall s Algorithm: Transitive Closure

CS 0 Theory of Algorithms / CS 68 Algorithms in Bioinformaticsi Dynamic Programming Part II. Warshall s Algorithm: Transitive Closure Computes the transitive closure of a relation (Alternatively: all paths

### 2.3 Scheduling jobs on identical parallel machines

2.3 Scheduling jobs on identical parallel machines There are jobs to be processed, and there are identical machines (running in parallel) to which each job may be assigned Each job = 1,,, must be processed

### SECTIONS 1.5-1.6 NOTES ON GRAPH THEORY NOTATION AND ITS USE IN THE STUDY OF SPARSE SYMMETRIC MATRICES

SECIONS.5-.6 NOES ON GRPH HEORY NOION ND IS USE IN HE SUDY OF SPRSE SYMMERIC MRICES graph G ( X, E) consists of a finite set of nodes or vertices X and edges E. EXMPLE : road map of part of British Columbia

### 1 Basic Definitions and Concepts in Graph Theory

CME 305: Discrete Mathematics and Algorithms 1 Basic Definitions and Concepts in Graph Theory A graph G(V, E) is a set V of vertices and a set E of edges. In an undirected graph, an edge is an unordered

### Divide-and-Conquer. Three main steps : 1. divide; 2. conquer; 3. merge.

Divide-and-Conquer Three main steps : 1. divide; 2. conquer; 3. merge. 1 Let I denote the (sub)problem instance and S be its solution. The divide-and-conquer strategy can be described as follows. Procedure

### Trees and Fundamental Circuits

Trees and Fundamental Circuits Tree A connected graph without any circuits. o must have at least one vertex. o definition implies that it must be a simple graph. o only finite trees are being considered

### Inhalt. Non-Standard Database Systems. Graph Terms. Storing Data in Graphs Examples. Graph Databases

Inhalt Non-Standard Database Systems Graph Databases Nikolaus Augsten nikolaus.augsten@sbg.ac.at FB Computerwissenschaften Universität Salzburg 1 2 3 http://dbresearch.uni-salzburg.at Sommersemester 2016

### Distributed Computing over Communication Networks: Maximal Independent Set

Distributed Computing over Communication Networks: Maximal Independent Set What is a MIS? MIS An independent set (IS) of an undirected graph is a subset U of nodes such that no two nodes in U are adjacent.

### The Basics of Graphical Models

The Basics of Graphical Models David M. Blei Columbia University October 3, 2015 Introduction These notes follow Chapter 2 of An Introduction to Probabilistic Graphical Models by Michael Jordan. Many figures

### NETZCOPE - a tool to analyze and display complex R&D collaboration networks

The Task Concepts from Spectral Graph Theory EU R&D Network Analysis Netzcope Screenshots NETZCOPE - a tool to analyze and display complex R&D collaboration networks L. Streit & O. Strogan BiBoS, Univ.

### A SOCIAL NETWORK ANALYSIS APPROACH TO ANALYZE ROAD NETWORKS INTRODUCTION

A SOCIAL NETWORK ANALYSIS APPROACH TO ANALYZE ROAD NETWORKS Kyoungjin Park Alper Yilmaz Photogrammetric and Computer Vision Lab Ohio State University park.764@osu.edu yilmaz.15@osu.edu ABSTRACT Depending

### CS325: Analysis of Algorithms, Fall Midterm Solutions

CS325: Analysis of Algorithms, Fall 2016 Midterm Solutions I don t know policy: you may write I don t know and nothing else to answer a question and receive 25 percent of the total points for that problem

### Sample Problems in Discrete Mathematics

Sample Problems in Discrete Mathematics This handout lists some sample problems that you should be able to solve as a pre-requisite to Computer Algorithms Try to solve all of them You should also read

### Big Graph Processing: Some Background

Big Graph Processing: Some Background Bo Wu Colorado School of Mines Part of slides from: Paul Burkhardt (National Security Agency) and Carlos Guestrin (Washington University) Mines CSCI-580, Bo Wu Graphs

### Chapter 4. Trees. 4.1 Basics

Chapter 4 Trees 4.1 Basics A tree is a connected graph with no cycles. A forest is a collection of trees. A vertex of degree one, particularly in a tree, is called a leaf. Trees arise in a variety of applications.

### 5.1 Bipartite Matching

CS787: Advanced Algorithms Lecture 5: Applications of Network Flow In the last lecture, we looked at the problem of finding the maximum flow in a graph, and how it can be efficiently solved using the Ford-Fulkerson

### Answer: (a) Since we cannot repeat men on the committee, and the order we select them in does not matter, ( )

1. (Chapter 1 supplementary, problem 7): There are 12 men at a dance. (a) In how many ways can eight of them be selected to form a cleanup crew? (b) How many ways are there to pair off eight women at the

### Definition. A graph is a collection of vertices, and edges between them. They are often represented by a drawing:

1. GRAPHS AND COLORINGS Definition. A graph is a collection of vertices, and edges between them. They are often represented by a drawing: 3 vertices 3 edges 4 vertices 4 edges 4 vertices 6 edges A graph

### Lecture 3: Linear Programming Relaxations and Rounding

Lecture 3: Linear Programming Relaxations and Rounding 1 Approximation Algorithms and Linear Relaxations For the time being, suppose we have a minimization problem. Many times, the problem at hand can