An Introduction to APGL

Size: px
Start display at page:

Download "An Introduction to APGL"

Transcription

1 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 overview and start to learn some of the core functionality using this short article. Contents 1 Introduction 1 2 Download and Installation 2 3 Graph Storage and Manipulation Creation and Basic Operations Graph Properties Set Operations Input/Output Interfacing with NetworkX and igraph Creating a DictGraph Random Graph Generation 7 5 Summary 8 1 Introduction APGL: Another Python Graph Library 1 has a self-explanatory title: it is a library for graph manipulation using pure Python 2. One of the main features of APGL is that the graph objects are based on adjacency matrices implemented using NumPy 3, SciPy and Pysparse 5, which allows for fast and memory efficient implementations of numerous algorithms. The sparse graph classes can scale up to 1,000,000s of vertices and edges on a standard PC

2 In this document we show how to install the library and demonstrate, using simple examples, some important functionality. Graph creation, manipulation, and input/output are exemplified. 2 Download and Installation One can download APGL for Windows, Linux or Mac OS using Sourceforge or the Python Package Index (PyPI) To use this library you must have Python, NumPy and SciPy installed. The code has been verified on Python 2.7.2, Numpy and Scipy , but should work with other versions. The automatic testing routine requires Python 2.7 or later, or the unittest2 testing framework for Python To install the package, ensure that pip 6 is installed, and then run: pip i n s t a l l apgl If installing from source unzip the apgl-x.y.z.tar.gz file and then run setup.py as follows: python setup. py i n s t a l l In order to test the library (recommended), using the following commands in python import apgl apgl. t e s t ( ) and check that all tested pass. 3 Graph Storage and Manipulation A graph G = (V, E) is denoted by a set of vertices V and edges E V V, in which an edge is a relation between a pair of vertices. The current graph types in APGL are SparseGraph, DenseGraph and PySparseGraph which use adjacency or weight matrices as the underlying data structure. Note that there is also the DictGraph class, which does not use weight matrices and is described in Section 3.6. For a graph with n vertices, an adjacency matrix A has a value of 1 at the ijth entry if an edge exists between vertices i and j, otherwise the entry is zero. A weight matrix is identical to an adjacency matrix except that matrix elements can take any real value, and a non-zero element indicates an edge between vertices. In an undirected graph, an edge exists from vertex i to j whenever there is an edge from j to i. A directed graph does not have this constraint. In APGL, the edges in a graph are stored using weight matrices and the three different graph classes differ mainly in their underlying storage mechanism. 6 2

3 DenseGraph uses numpy.ndarrays to store adjacencies whereas SparseGraph uses the scipy.sparse classes and is efficient for the storage of large graphs without many edges. As the scipy.sparse classes are written in Python we also provide PySparseGraph which uses Pysparse to store adjacencies. Many matrix operations for Pysparse are written in C and hence may be faster than the scipy.sparse ones. Edge values can currently only be numerical, however vertices can be labelled with anything using a subclass of the AbstractVertexList class. Currently, there are two general way of labelling vertices: using numpy.ndarrays in conjunction with VertexList, and with any label using GeneralVertexList. AbstractVertexList can easily be extended in order to define different vertex labelling methods. 3.1 Creation and Basic Operations We start by demonstrating the creation of a graph using SparseGraph. Notice that DenseGraph and PySparseGraph operate in a near-identical manner. 1 import numpy 2 from apgl. graph. V e r t e x L i s t import V e r t e x L i s t 3 from apgl. graph. SparseGraph import SparseGraph numvertices = 5 5 numfeatures = 2 6 graph = SparseGraph ( V e r t e x L i s t ( numvertices, numfeatures ) ) 7 8 #Add some edges to the graph #V e r t i c e s are indexed s t a r t i n g from 0 10 graph [ 0, 1 ] = graph [ 1, 2 ] = #Set the l a b e l o f the 0 th v e r t e x to [ 2, 3 ] 1 graph. s e t V e r t e x ( 0, numpy. array ( [ 2, 3 ] ) ) #D i s p l a y s edge weights 17 p r i n t ( graph [ 1, 2 ] ) 18 p r i n t ( graph [ 1, 3 ] ) The first 2 lines import all of the graph classes required. Following, a VertexList object is created with 5 vertices and vector labels of size 2, which are all initialised to zero. Using this VertexList object, a SparseGraph object is created with no edges. By default, the SparseGraph is an undirected graph, however we will later show how to construct directed graphs. Two edges are added to the graph from vertex 0 to 1 with a weight of 0.1, and from 1 to 2 with a weight of 1.0. Notice that one can only add non-zero edge labels, as zero indicates the absence of an edge. Notice that edges can be referenced as if accessing a matrix directly. Often it is more convenient to add edges in a group rather than individually, and in this case one can use the addedges method. For example, the above code can be modified as follows to produce the same results 1 #Add some edges to the graph 2 edges = numpy. array ( [ [ 0, 1 ], [ 1, 2 ] ], numpy. i n t ) 3 edgevalues = numpy. array ( [ 0. 1, 1. 0 ] ) graph. addedges ( edges, edgevalues ) 5 3

4 6 #D i s p l a y s edge weight between v e r t i c e s 1 and 2 7 p r i n t ( graph [ 1, 2 ] ) The call to addedges uses a matrix of size m 2 as the first parameter and an array of length m of edge values as the second parameter. Each row of the matrix edges corresponds to an edge between two vertices and the corresponding value in edgevalue is the corresponding value. SparseGraphs are created by default using the SciPy csr matrix class (Compressed Sparse Row matrix), which allows for fast access to the rows of the adjacency matrix. One can also create a SparseGraph using other types of sparse matrix (currently limited to lil matrix, csr matrix, csc matrix and dok matrix): 1 import numpy 2 import s c i p y. s p a r s e as sps 3 from apgl. graph. G e n e r a l V e r t e x L i s t import G e n e r a l V e r t e x L i s t from apgl. graph. SparseGraph import SparseGraph 5 numvertices = 10 6 v L i s t = G e n e r a l V e r t e x L i s t ( numvertices ) 7 Wght = sps. c s c m a t r i x ( ( numvertices, numvertices ) ) 8 graph = SparseGraph ( vlist, W=Wght, u n d i r e c t e d=f a l s e ) 10 graph [ 0, 1 ] = 1 11 graph [ 0, 2 ] = 1 12 graph. s e t V e r t e x ( 0, abc ) 13 graph. s e t V e r t e x ( 1, 123) 1 15 p r i n t ( graph. i n D e g r e e D i s t r i b u t i o n ( ) ) Here, we use a different type of vertex list using the GeneralVertexList class, which allows vertex labels to take any value. The sparse matrix used in the graph is a scipy.sparse.csc matrix which is in Compressed Sparse Column format. The final parameter used in the constructor specifies that the resulting graph is directed. Following graph construction, the first and second vertices are initialised with abc and 123 respectively. The final line of the example computes the in-degree distribution of the graph, which is faster when the adjacency matrix is a csc matrix compared to the default choice of csr matrix. In this case however, the speed difference is negligible as the graph is very small. With larger graphs, the choice of weight matrix type can significantly affect the speed of graph algorithms. SparseGraph and DenseGraph have a number of additional methods for querying and modifying the underlying graph. For example, getnumedges() and getnumvertices() return the number of edges and vertices respectively. The neighbours(vertexid) method returns the set of neighbouring vertices for the given vertexid, and neighbourof returns the set of vertices which have edges to vertexid for a directed graph. 3.2 Graph Properties To study the characteristics of graphs, various properties have been proposed in the research literature. Some of the most common ones are shown below

5 (the interested reader is directed to e.g. [1] for more precise definitions of the properties): clusteringcoefficient() - 3 times the number of triples divided by the number of triangles density() - The proportion of edges vs. total possible number of edges diameter() - Length of the longest shortest path in the graph effectivediameter(p) - A more robust alternative to the diameter geodesicdistance() - Mean shortest distance between all pairs of vertices harmonicgeodesicdistance() - Mean harmonic shortest distance between all pairs of vertices Several of the methods above require the computation of the shortest paths between all pairs of vertices. The matrix of shortest paths P can be found using the Floyd-Warshall algorithm [2] at a computational cost of O(n 3 ) where n is the size of the graph. The ijth entry of P is the shortest path between vertices i and j. To compute diameters and geodesic distances, one can optionally pass in a matrix P as follows: 1 from apgl. graph. G e n e r a l V e r t e x L i s t import G e n e r a l V e r t e x L i s t 2 from apgl. graph. SparseGraph import SparseGraph 3 numvertices = 10 5 graph = SparseGraph ( G e n e r a l V e r t e x L i s t ( numvertices ) ) 6 7 graph [ 0, 1 ] = 1 8 graph [ 0, 2 ] = 1 10 P = graph. f l o y d W a r s h a l l ( ) 11 p r i n t ( graph. g e o d e s i c D i s t a n c e (P=P) ) 12 p r i n t ( graph. harmonicgeodesicdistance (P=P) ) The above example outputs both the mean geodesic distance and harmonic mean geodesic distance using the matrix P as computed using the floydwarshall method (note that one can also use findalldistances which is based on Dijkstra s algorithm). As P is computed only once but used twice, this usage reduces computational cost over making the default calls of the distance methods. 3.3 Set Operations By considering the edges as a set of pairs of vertices one can perform various set operations with graphs, and some of these are listed in in Table 1. The first methods in Table 1 consider the edges in the graphs without weights, hence the resulting returned graphs contain adjacency matrices only. For the subgraph method, the graph returned contains only those vertices indexed by vinds and edges between these vertices. 5

6 Example Method Call g1.union(g2) g1.intersect(g2) g1.setdiff(g2) g1.complement() g1.subgraph(vinds) Description Union between graph edges Intersection of graph edges Find edges in g1 that are not in g2 Find the graph with edges which are not present in g1 Compute the subgraph using the selected vertices Table 1: Methods to perform set operations using graphs g1 and g2, and vertex indices set vinds. 3. Input/Output Simple file reading and writing is possible by using a pre-defined comma separated value format which is exemplified as follows: Vertices Edges 0, 1, 1 2,, 1, 0, 1 2, 2, 1 Vertex labels can only be integers and must be listed after Vertices. Following, edges are given as a sequence of triples corresponding to two vertices and the last value in the triple is the edge weight. In the case that the graph is directed one should replace Edges with Arcs. The graph corresponding to this file (saved as test.txt ) is read using the code: 1 from apgl. i o import SimpleGraphReader 2 3 filename = t e s t. t x t graphreader = SimpleGraphReader ( ) 5 graph = graphreader. readfromfile ( filename ) 6 7 p r i n t ( graph. getalledges ( ) ) 8 #Save the edges and v e r t i c e s i n testgraph. z i p 10 graph. save ( testgraph ) The graph returned from graphreader is a SparseGraph. Furthermore, the output of the final line of the code is [[1 0] [2 2] [ 0] [ 2]]. In order to write graphs in this format, one can use the SimpleGraphWriter class. Notice that SimpleGraphReader and SimpleGraphReader work with only the edges of the graph, i.e. vertex labels are not stored. To save complete graphs, including the vertex labels, one can use the save and load methods which store and load the weight matrices in matrix market format. 6

7 3.5 Interfacing with NetworkX and igraph NetworkX 7 is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks. In APGL there are methods to convert between NetworkX graphs and APGL ones. To convert from a PySparseGraph, SparseGraph or DenseGraph to a NetworkX undirected Graph or directed DiGraph, one can use the tonetworkx method. See the reference documentation for more details. Similarly, there is toigraph to output igraph 8 objects. 3.6 Creating a DictGraph It might seem that the construction of the graph classes is restrictive as one is required to construct an object with the number of vertices, and these vertices are indexed using integers. For growing graphs with non-integer names we provide the DictGraph class which uses a dictionary of dictionaries to store adjacencies. One can easily create and populate a DictGraph and then transfer the edges to a matrix graph: 1 from apgl. graph. DictGraph import DictGraph 2 from apgl. graph. SparseGraph import SparseGraph 3 from apgl. graph. G e n e r a l V e r t e x L i s t import G e n e r a l V e r t e x L i s t 5 graph = DictGraph ( ) 6 graph. addedge ( a, b ) 7 graph. addedge ( a, c ) 8 graph. addedge ( a, d ) 10 e d g e I n d i c e s = graph. g e t A l l E d g e I n d i c e s ( ) 11 graph2 = SparseGraph ( G e n e r a l V e r t e x L i s t ( graph. getnumvertices ( ) ) ) 12 graph2. addedges ( e d g e I n d i c e s ) The mapping between vertex names in DictGraph and those in SparseGraph can be found using graph.getalledgeindices(). A useful subclass of DictGraph which restricts the input to trees is DictTree, see the reference for more details. Random Graph Generation As well as creating graphs in the fashion outlined in the preceding examples, one can use a number of graph generators to produce graphs in random and non-random ways. Currently, there are 5 random graph generator types: BarabasiAlbertGenerator, ConfigModelGenerator, ErdosRenyiGenerator, KroneckerGenerator and SmallWorldGenerator. In the following code block, we show how to generate a random graph using an Erdos-Renyi [3] process: 1 from apgl. graph. DenseGraph import DenseGraph 2 from apgl. graph. G e n e r a l V e r t e x L i s t import G e n e r a l V e r t e x L i s t 3 from apgl. g e n e r a t o r. ErdosRenyiGenerator import 5 numvertices = 20 6 graph = DenseGraph ( G e n e r a l V e r t e x L i s t ( numvertices ) )

8 7 8 p = 0. 2 g e n e r a t o r = ErdosRenyiGenerator ( p ) 10 graph = g e n e r a t o r. g e n e r a t e ( graph ) For the ErdosRenyiGenerator object, the probability of an edge between any vertices is set to 0.2, and edges are created independently of the other edges. Furthermore, no self edges are created. Figure 1 shows the resulting graph. Notice that the random graph created using ErdosRenyiGenerator uses the numpy.random module and consequently identical random graphs by using the same numpy.random.seed value Figure 1: An Erdos-Renyi graph generated using the ErdosRenyiGenerator class. 5 Summary We exemplified some of the main features of the APGL graph library, with the aim of getting one familiarised with the library. The basic graph types were introduced, as well as how to manipulate graphs, find graph properties, perform set operations, write and read from files and generate random graphs. For much more information, see the reference documentation online at 8

9 References [1] M. E. J. Newman. The structure and function of complex networks. SIAM Review, 5(2): , [2] Stephen Warshall. A theorem on boolean matrices. Journal of the ACM, (1):11 12, 162. [3] Paul Erdős and Alfréd Rényi. On random graphs. Publicationes Mathematicae, 6:20 27, 15.

Social Media Mining. Graph Essentials

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

More information

Practical Graph Mining with R. 5. Link Analysis

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

More information

Tools and Techniques for Social Network Analysis

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

More information

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

More information

Introduction to Mathematics for Software Engineering

Introduction to Mathematics for Software Engineering Introduction to Mathematics for Software Engineering SET07106 Mathematics for Software Engineering School of Computing Edinburgh Napier University Module Leader: Uta Priss 2010 Copyright Edinburgh Napier

More information

DATA ANALYSIS II. Matrix Algorithms

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

More information

Software tools for Complex Networks Analysis. Fabrice Huet, University of Nice Sophia- Antipolis SCALE (ex-oasis) Team

Software tools for Complex Networks Analysis. Fabrice Huet, University of Nice Sophia- Antipolis SCALE (ex-oasis) Team Software tools for Complex Networks Analysis Fabrice Huet, University of Nice Sophia- Antipolis SCALE (ex-oasis) Team MOTIVATION Why do we need tools? Source : nature.com Visualization Properties extraction

More information

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs CSE599s: Extremal Combinatorics November 21, 2011 Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs Lecturer: Anup Rao 1 An Arithmetic Circuit Lower Bound An arithmetic circuit is just like

More information

CS2 Algorithms and Data Structures Note 11. Breadth-First Search and Shortest Paths

CS2 Algorithms and Data Structures Note 11. Breadth-First Search and Shortest Paths CS2 Algorithms and Data Structures Note 11 Breadth-First Search and Shortest Paths In this last lecture of the CS2 Algorithms and Data Structures thread we will consider the problem of computing distances

More information

Warshall s Algorithm: Transitive Closure

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

More information

Mining Social Network Graphs

Mining Social Network Graphs Mining Social Network Graphs Debapriyo Majumdar Data Mining Fall 2014 Indian Statistical Institute Kolkata November 13, 17, 2014 Social Network No introduc+on required Really? We s7ll need to understand

More information

V. Adamchik 1. Graph Theory. Victor Adamchik. Fall of 2005

V. Adamchik 1. Graph Theory. Victor Adamchik. Fall of 2005 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

More information

Network Analysis and Visualization of Staphylococcus aureus. by Russ Gibson

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

More information

A comparative study of social network analysis tools

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

More information

NetworkX: Network Analysis with Python

NetworkX: Network Analysis with Python NetworkX: Network Analysis with Python Salvatore Scellato Full tutorial presented at the XXX SunBelt Conference NetworkX introduction: Hacking social networks using the Python programming language by Aric

More information

12 Abstract Data Types

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

More information

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

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

More information

Frans J.C.T. de Ruiter, Norman L. Biggs Applications of integer programming methods to cages

Frans J.C.T. de Ruiter, Norman L. Biggs Applications of integer programming methods to cages Frans J.C.T. de Ruiter, Norman L. Biggs Applications of integer programming methods to cages Article (Published version) (Refereed) Original citation: de Ruiter, Frans and Biggs, Norman (2015) Applications

More information

10. Graph Matrices Incidence Matrix

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

More information

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

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-

More information

Graphical degree sequences and realizations

Graphical degree sequences and realizations swap Graphical and realizations Péter L. Erdös Alfréd Rényi Institute of Mathematics Hungarian Academy of Sciences MAPCON 12 MPIPKS - Dresden, May 15, 2012 swap Graphical and realizations Péter L. Erdös

More information

SGL: Stata graph library for network analysis

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

More information

Graphs, Networks and Python: The Power of Interconnection. Lachlan Blackhall - lachlan@repositpower.com

Graphs, Networks and Python: The Power of Interconnection. Lachlan Blackhall - lachlan@repositpower.com Graphs, Networks and Python: The Power of Interconnection Lachlan Blackhall - lachlan@repositpower.com A little about me Graphs Graph, G = (V, E) V = Vertices / Nodes E = Edges NetworkX Native graph

More information

Social Media Mining. Network Measures

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

More information

Class One: Degree Sequences

Class One: Degree Sequences Class One: Degree Sequences For our purposes a graph is a just a bunch of points, called vertices, together with lines or curves, called edges, joining certain pairs of vertices. Three small examples of

More information

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

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!)

More information

Data Structures and Algorithms Written Examination

Data Structures and Algorithms Written Examination Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where

More information

Dynamic Programming. Applies when the following Principle of Optimality

Dynamic Programming. Applies when the following Principle of Optimality Dynamic Programming Applies when the following Principle of Optimality holds: In an optimal sequence of decisions or choices, each subsequence must be optimal. Translation: There s a recursive solution.

More information

An Empirical Study of Two MIS Algorithms

An Empirical Study of Two MIS Algorithms An Empirical Study of Two MIS Algorithms Email: Tushar Bisht and Kishore Kothapalli International Institute of Information Technology, Hyderabad Hyderabad, Andhra Pradesh, India 32. tushar.bisht@research.iiit.ac.in,

More information

Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010. Chapter 7: Digraphs

Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010. Chapter 7: Digraphs MCS-236: Graph Theory Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010 Chapter 7: Digraphs Strong Digraphs Definitions. A digraph is an ordered pair (V, E), where V is the set

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

More information

Distance Degree Sequences for Network Analysis

Distance Degree Sequences for Network Analysis Universität Konstanz Computer & Information Science Algorithmics Group 15 Mar 2005 based on Palmer, Gibbons, and Faloutsos: ANF A Fast and Scalable Tool for Data Mining in Massive Graphs, SIGKDD 02. Motivation

More information

2+2 Just type and press enter and the answer comes up ans = 4

2+2 Just type and press enter and the answer comes up ans = 4 Demonstration Red text = commands entered in the command window Black text = Matlab responses Blue text = comments 2+2 Just type and press enter and the answer comes up 4 sin(4)^2.5728 The elementary functions

More information

Intro to scientific programming (with Python) Pietro Berkes, Brandeis University

Intro to scientific programming (with Python) Pietro Berkes, Brandeis University Intro to scientific programming (with Python) Pietro Berkes, Brandeis University Next 4 lessons: Outline Scientific programming: best practices Classical learning (Hoepfield network) Probabilistic learning

More information

COUNTING INDEPENDENT SETS IN SOME CLASSES OF (ALMOST) REGULAR GRAPHS

COUNTING INDEPENDENT SETS IN SOME CLASSES OF (ALMOST) REGULAR GRAPHS COUNTING INDEPENDENT SETS IN SOME CLASSES OF (ALMOST) REGULAR GRAPHS Alexander Burstein Department of Mathematics Howard University Washington, DC 259, USA aburstein@howard.edu Sergey Kitaev Mathematics

More information

Distributed R for Big Data

Distributed R for Big Data Distributed R for Big Data Indrajit Roy HP Vertica Development Team Abstract Distributed R simplifies large-scale analysis. It extends R. R is a single-threaded environment which limits its utility for

More information

OPTIMAL DESIGN OF DISTRIBUTED SENSOR NETWORKS FOR FIELD RECONSTRUCTION

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

More information

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.

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

More information

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

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,

More information

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

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

More information

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

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

More information

Graph Algorithms. Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar

Graph Algorithms. Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar Graph Algorithms Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text Introduction to Parallel Computing, Addison Wesley, 3. Topic Overview Definitions and Representation Minimum

More information

Analysis of Algorithms, I

Analysis of Algorithms, I Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, February 26, 2015 Outline 1 Recap 2 Representing graphs 3 Breadth-first search (BFS) 4 Applications

More information

One last point: we started off this book by introducing another famously hard search problem:

One last point: we started off this book by introducing another famously hard search problem: S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 261 Factoring One last point: we started off this book by introducing another famously hard search problem: FACTORING, the task of finding all prime factors

More information

Linear Algebra and TI 89

Linear Algebra and TI 89 Linear Algebra and TI 89 Abdul Hassen and Jay Schiffman This short manual is a quick guide to the use of TI89 for Linear Algebra. We do this in two sections. In the first section, we will go over the editing

More information

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

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

More information

KEYWORD SEARCH OVER PROBABILISTIC RDF GRAPHS

KEYWORD SEARCH OVER PROBABILISTIC RDF GRAPHS ABSTRACT KEYWORD SEARCH OVER PROBABILISTIC RDF GRAPHS In many real applications, RDF (Resource Description Framework) has been widely used as a W3C standard to describe data in the Semantic Web. In practice,

More information

Finding and counting given length cycles

Finding and counting given length cycles Finding and counting given length cycles Noga Alon Raphael Yuster Uri Zwick Abstract We present an assortment of methods for finding and counting simple cycles of a given length in directed and undirected

More information

Data Structures in Java. Session 16 Instructor: Bert Huang

Data Structures in Java. Session 16 Instructor: Bert Huang Data Structures in Java Session 16 Instructor: Bert Huang http://www.cs.columbia.edu/~bert/courses/3134 Announcements Homework 4 due next class Remaining grades: hw4, hw5, hw6 25% Final exam 30% Midterm

More information

Edges = communication links Vertices = computers, switches, routers, etc. For packet inbound at a particular vertex, determine what output edge to use

Edges = communication links Vertices = computers, switches, routers, etc. For packet inbound at a particular vertex, determine what output edge to use IP Routing Networks as Graphs Networks are graphs Edges = communication links Vertices = computers, switches, routers, etc For packet inbound at a particular vertex, determine what output edge to use Routers

More information

The Open University s repository of research publications and other research outputs

The Open University s repository of research publications and other research outputs Open Research Online The Open University s repository of research publications and other research outputs The degree-diameter problem for circulant graphs of degree 8 and 9 Journal Article How to cite:

More information

Chapter 6: Graph Theory

Chapter 6: Graph Theory Chapter 6: Graph Theory Graph theory deals with routing and network problems and if it is possible to find a best route, whether that means the least expensive, least amount of time or the least distance.

More information

2.3 Scheduling jobs on identical parallel machines

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

More information

Discrete Mathematics & Mathematical Reasoning Chapter 10: Graphs

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

More information

VISUAL ALGEBRA FOR COLLEGE STUDENTS. Laurie J. Burton Western Oregon University

VISUAL ALGEBRA FOR COLLEGE STUDENTS. Laurie J. Burton Western Oregon University VISUAL ALGEBRA FOR COLLEGE STUDENTS Laurie J. Burton Western Oregon University VISUAL ALGEBRA FOR COLLEGE STUDENTS TABLE OF CONTENTS Welcome and Introduction 1 Chapter 1: INTEGERS AND INTEGER OPERATIONS

More information

Scientific Programming in Python

Scientific Programming in Python UCSD March 9, 2009 What is Python? Python in a very high level (scripting) language which has gained widespread popularity in recent years. It is: What is Python? Python in a very high level (scripting)

More information

Solution Guide for Chapter 6: The Geometry of Right Triangles

Solution Guide for Chapter 6: The Geometry of Right Triangles Solution Guide for Chapter 6: The Geometry of Right Triangles 6. THE THEOREM OF PYTHAGORAS E-. Another demonstration: (a) Each triangle has area ( ). ab, so the sum of the areas of the triangles is 4 ab

More information

Ramsey numbers for bipartite graphs with small bandwidth

Ramsey numbers for bipartite graphs with small bandwidth Ramsey numbers for bipartite graphs with small bandwidth Guilherme O. Mota 1,, Gábor N. Sárközy 2,, Mathias Schacht 3,, and Anusch Taraz 4, 1 Instituto de Matemática e Estatística, Universidade de São

More information

Midterm Practice Problems

Midterm Practice Problems 6.042/8.062J Mathematics for Computer Science October 2, 200 Tom Leighton, Marten van Dijk, and Brooke Cowan Midterm Practice Problems Problem. [0 points] In problem set you showed that the nand operator

More information

Automated Model Based Testing for an Web Applications

Automated Model Based Testing for an Web Applications Automated Model Based Testing for an Web Applications Agasarpa Mounica, Lokanadham Naidu Vadlamudi Abstract- As the development of web applications plays a major role in our day-to-day life. Modeling the

More information

Zachary Monaco Georgia College Olympic Coloring: Go For The Gold

Zachary Monaco Georgia College Olympic Coloring: Go For The Gold Zachary Monaco Georgia College Olympic Coloring: Go For The Gold Coloring the vertices or edges of a graph leads to a variety of interesting applications in graph theory These applications include various

More information

MODEL SELECTION FOR SOCIAL NETWORKS USING GRAPHLETS

MODEL SELECTION FOR SOCIAL NETWORKS USING GRAPHLETS MODEL SELECTION FOR SOCIAL NETWORKS USING GRAPHLETS JEANNETTE JANSSEN, MATT HURSHMAN, AND NAUZER KALYANIWALLA Abstract. Several network models have been proposed to explain the link structure observed

More information

Linear Dependence Tests

Linear Dependence Tests Linear Dependence Tests The book omits a few key tests for checking the linear dependence of vectors. These short notes discuss these tests, as well as the reasoning behind them. Our first test checks

More information

COMBINATORIAL PROPERTIES OF THE HIGMAN-SIMS GRAPH. 1. Introduction

COMBINATORIAL PROPERTIES OF THE HIGMAN-SIMS GRAPH. 1. Introduction COMBINATORIAL PROPERTIES OF THE HIGMAN-SIMS GRAPH ZACHARY ABEL 1. Introduction In this survey we discuss properties of the Higman-Sims graph, which has 100 vertices, 1100 edges, and is 22 regular. In fact

More information

Repetition and Loops. Additional Python constructs that allow us to effect the (1) order and (2) number of times that program statements are executed.

Repetition and Loops. Additional Python constructs that allow us to effect the (1) order and (2) number of times that program statements are executed. New Topic Repetition and Loops Additional Python constructs that allow us to effect the (1) order and (2) number of times that program statements are executed. These constructs are the 1. while loop and

More information

Course on Social Network Analysis Graphs and Networks

Course on Social Network Analysis Graphs and Networks Course on Social Network Analysis Graphs and Networks Vladimir Batagelj University of Ljubljana Slovenia V. Batagelj: Social Network Analysis / Graphs and Networks 1 Outline 1 Graph...............................

More information

SCIENTIFIC COMPUTING AND PROGRAMMING IN THE CLOUD USING OPEN SOURCE PLATFORMS: AN ILLUSTRATION USING WEIGHTED VOTING SYSTEMS

SCIENTIFIC COMPUTING AND PROGRAMMING IN THE CLOUD USING OPEN SOURCE PLATFORMS: AN ILLUSTRATION USING WEIGHTED VOTING SYSTEMS SCIENTIFIC COMPUTING AND PROGRAMMING IN THE CLOUD USING OPEN SOURCE PLATFORMS: AN ILLUSTRATION USING WEIGHTED VOTING SYSTEMS Mohamed I Jamaloodeen Georgia Gwinnet College School of Science and Technology

More information

Technology, Kolkata, INDIA, pal.sanjaykumar@gmail.com. sssarma2001@yahoo.com

Technology, Kolkata, INDIA, pal.sanjaykumar@gmail.com. sssarma2001@yahoo.com Sanjay Kumar Pal 1 and Samar Sen Sarma 2 1 Department of Computer Science & Applications, NSHM College of Management & Technology, Kolkata, INDIA, pal.sanjaykumar@gmail.com 2 Department of Computer Science

More information

Complex Networks Analysis: Clustering Methods

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

More information

Walk-Based Centrality and Communicability Measures for Network Analysis

Walk-Based Centrality and Communicability Measures for Network Analysis Walk-Based Centrality and Communicability Measures for Network Analysis Michele Benzi Department of Mathematics and Computer Science Emory University Atlanta, Georgia, USA Workshop on Innovative Clustering

More information

Helvetic Coding Contest 2016

Helvetic Coding Contest 2016 Helvetic Coding Contest 6 Solution Sketches July, 6 A Collective Mindsets Author: Christian Kauth A Strategy: In a bottom-up approach, we can determine how many brains a zombie of a given rank N needs

More information

GRAPH THEORY LECTURE 4: TREES

GRAPH THEORY LECTURE 4: TREES GRAPH THEORY LECTURE 4: TREES Abstract. 3.1 presents some standard characterizations and properties of trees. 3.2 presents several different types of trees. 3.7 develops a counting method based on a bijection

More information

My work provides a distinction between the national inputoutput model and three spatial models: regional, interregional y multiregional

My work provides a distinction between the national inputoutput model and three spatial models: regional, interregional y multiregional Mexico, D. F. 25 y 26 de Julio, 2013 My work provides a distinction between the national inputoutput model and three spatial models: regional, interregional y multiregional Walter Isard (1951). Outline

More information

Clique coloring B 1 -EPG graphs

Clique coloring B 1 -EPG graphs Clique coloring B 1 -EPG graphs Flavia Bonomo a,c, María Pía Mazzoleni b,c, and Maya Stein d a Departamento de Computación, FCEN-UBA, Buenos Aires, Argentina. b Departamento de Matemática, FCE-UNLP, La

More information

The mathematics of networks

The mathematics of networks The mathematics of networks M. E. J. Newman Center for the Study of Complex Systems, University of Michigan, Ann Arbor, MI 48109 1040 In much of economic theory it is assumed that economic agents interact,

More information

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

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

More information

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory CSC2420 Fall 2012: Algorithm Design, Analysis and Theory Allan Borodin November 15, 2012; Lecture 10 1 / 27 Randomized online bipartite matching and the adwords problem. We briefly return to online algorithms

More information

A scalable multilevel algorithm for graph clustering and community structure detection

A scalable multilevel algorithm for graph clustering and community structure detection A scalable multilevel algorithm for graph clustering and community structure detection Hristo N. Djidjev 1 Los Alamos National Laboratory, Los Alamos, NM 87545 Abstract. One of the most useful measures

More information

International Journal of Software and Web Sciences (IJSWS) www.iasir.net

International Journal of Software and Web Sciences (IJSWS) www.iasir.net International Association of Scientific Innovation and Research (IASIR) (An Association Unifying the Sciences, Engineering, and Applied Research) ISSN (Print): 2279-0063 ISSN (Online): 2279-0071 International

More information

Chapter 10: Network Flow Programming

Chapter 10: Network Flow Programming Chapter 10: Network Flow Programming Linear programming, that amazingly useful technique, is about to resurface: many network problems are actually just special forms of linear programs! This includes,

More information

Section Summary. Introduction to Graphs Graph Taxonomy Graph Models

Section Summary. Introduction to Graphs Graph Taxonomy Graph Models Chapter 10 Chapter Summary Graphs and Graph Models Graph Terminology and Special Types of Graphs Representing Graphs and Graph Isomorphism Connectivity Euler and Hamiltonian Graphs Shortest-Path Problems

More information

Discrete Mathematics. Hans Cuypers. October 11, 2007

Discrete Mathematics. Hans Cuypers. October 11, 2007 Hans Cuypers October 11, 2007 1 Contents 1. Relations 4 1.1. Binary relations................................ 4 1.2. Equivalence relations............................. 6 1.3. Relations and Directed Graphs.......................

More information

Part 2: Community Detection

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 -

More information

Data structures for statistical computing in Python Wes McKinney SciPy 2010 McKinney () Statistical Data Structures in Python SciPy 2010 1 / 31 Environments for statistics and data analysis The usual suspects:

More information

CIS 192: Lecture 13 Scientific Computing and Unit Testing

CIS 192: Lecture 13 Scientific Computing and Unit Testing CIS 192: Lecture 13 Scientific Computing and Unit Testing Lili Dworkin University of Pennsylvania Scientific Computing I Python is really popular in the scientific and statistical computing world I Why?

More information

www.objectivity.com An Introduction To Presented by Leon Guzenda, Founder, Objectivity

www.objectivity.com An Introduction To Presented by Leon Guzenda, Founder, Objectivity www.objectivity.com An Introduction To Graph Databases Presented by Leon Guzenda, Founder, Objectivity Mark Maagdenberg, Sr. Sales Engineer, Objectivity Paul DeWolf, Dir. Field Engineering, Objectivity

More information

Hadoop SNS. renren.com. Saturday, December 3, 11

Hadoop SNS. renren.com. Saturday, December 3, 11 Hadoop SNS renren.com Saturday, December 3, 11 2.2 190 40 Saturday, December 3, 11 Saturday, December 3, 11 Saturday, December 3, 11 Saturday, December 3, 11 Saturday, December 3, 11 Saturday, December

More information

General Network Analysis: Graph-theoretic. COMP572 Fall 2009

General Network Analysis: Graph-theoretic. COMP572 Fall 2009 General Network Analysis: Graph-theoretic Techniques COMP572 Fall 2009 Networks (aka Graphs) A network is a set of vertices, or nodes, and edges that connect pairs of vertices Example: a network with 5

More information

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

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.

More information

Stationary random graphs on Z with prescribed iid degrees and finite mean connections

Stationary random graphs on Z with prescribed iid degrees and finite mean connections Stationary random graphs on Z with prescribed iid degrees and finite mean connections Maria Deijfen Johan Jonasson February 2006 Abstract Let F be a probability distribution with support on the non-negative

More information

Informatique Fondamentale IMA S8

Informatique Fondamentale IMA S8 Informatique Fondamentale IMA S8 Cours 4 : graphs, problems and algorithms on graphs, (notions of) NP completeness Laure Gonnord http://laure.gonnord.org/pro/teaching/ Laure.Gonnord@polytech-lille.fr Université

More information

A Review And Evaluations Of Shortest Path Algorithms

A Review And Evaluations Of Shortest Path Algorithms A Review And Evaluations Of Shortest Path Algorithms Kairanbay Magzhan, Hajar Mat Jani Abstract: Nowadays, in computer networks, the routing is based on the shortest path problem. This will help in minimizing

More information

Circuits 1 M H Miller

Circuits 1 M H Miller Introduction to Graph Theory Introduction These notes are primarily a digression to provide general background remarks. The subject is an efficient procedure for the determination of voltages and currents

More information

SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH

SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH 31 Kragujevac J. Math. 25 (2003) 31 49. SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH Kinkar Ch. Das Department of Mathematics, Indian Institute of Technology, Kharagpur 721302, W.B.,

More information

BP2SAN From Business Processes to Stochastic Automata Networks

BP2SAN From Business Processes to Stochastic Automata Networks BP2SAN From Business Processes to Stochastic Automata Networks Kelly Rosa Braghetto Department of Computer Science University of São Paulo kellyrb@ime.usp.br March, 2011 Contents 1 Introduction 1 2 Instructions

More information

CSE 4351/5351 Notes 7: Task Scheduling & Load Balancing

CSE 4351/5351 Notes 7: Task Scheduling & Load Balancing CSE / Notes : Task Scheduling & Load Balancing Task Scheduling A task is a (sequential) activity that uses a set of inputs to produce a set of outputs. A task (precedence) graph is an acyclic, directed

More information

Diagonal, Symmetric and Triangular Matrices

Diagonal, Symmetric and Triangular Matrices Contents 1 Diagonal, Symmetric Triangular Matrices 2 Diagonal Matrices 2.1 Products, Powers Inverses of Diagonal Matrices 2.1.1 Theorem (Powers of Matrices) 2.2 Multiplying Matrices on the Left Right by

More information

Edge-betweenness index calculation

Edge-betweenness index calculation BIOINF-2006-0844 R Supplementary Material Edge-betweenness index calculation This supplementary material aims to briefly explain the edge betweenness calculation by illustrating the key steps. The example

More information

Week 3. Network Data; Introduction to Graph Theory and Sociometric Notation

Week 3. Network Data; Introduction to Graph Theory and Sociometric Notation Wasserman, Stanley, and Katherine Faust. 2009. Social Network Analysis: Methods and Applications, Structural Analysis in the Social Sciences. New York, NY: Cambridge University Press. Chapter III: Notation

More information

Partitioning edge-coloured complete graphs into monochromatic cycles and paths

Partitioning edge-coloured complete graphs into monochromatic cycles and paths arxiv:1205.5492v1 [math.co] 24 May 2012 Partitioning edge-coloured complete graphs into monochromatic cycles and paths Alexey Pokrovskiy Departement of Mathematics, London School of Economics and Political

More information