Counting Triangles in Data Streams∗

Counting Triangles in Data Streams∗

Counting Triangles in Data Streams∗ ∗ † Luciana S. Buriol Gereon Frahling Stefano Leonardi Departamento de Eletrˆonicae Heinz Nixdorf Institut Dipartimento di Informatica e Computac¸˜ao University of Paderborn, Sistemistica Universidade Federal de Germany Universit´adi Roma “La Santa Maria, Brazil frahling@uni- Sapienza", Italy [email protected] paderborn.de [email protected] Alberto Christian Sohler Marchetti-Spaccamela Heinz Nixdorf Institut Dipartimento di Informatica e University of Paderborn, Sistemistica Germany Universit´adi Roma “La Sapienza", Italy [email protected] [email protected] ABSTRACT tion of clustering and transitivity coefficient, and discovery We present two space bounded random sampling algorithms of frequent patterns in large graphs. that compute an approximation of the number of triangles We have implemented both algorithms and evaluated their in an undirected graph given as a stream of edges. Our first performance on networks from different application domains. , algorithm does not make any assumptions on the order of The sizes of the considered graphs varied from about 8 000 , edges in the stream. It uses space that is inversely related to nodes and 40 000 edges to 135 million nodes and more than the ratio between the number of triangles and the number of 1 billion edges. For both algorithms we run experiments s , , , , , triples with at least one edge in the induced subgraph, and with parameter =1000, 10 000, 100 000, 1 000 000 to constant expected update time per edge. Our second algo- evaluate running time and approximation guarantee. Both rithm is designed for incidence streams (all edges incident to algorithms appear to be time efficient for these sample sizes. the same vertex appear consecutively). It uses space that is The approximation quality of the first algorithm was vary- s , , inversely related to the ratio between the number of triangles ing significantly and even for =1000 000 we had more and length 2 paths in the graph and expected update time than 10% deviation for more than half of the instances. O(log |V |·(1+s·|V |/|E|)), where s is the space requirement The second algorithm performed much better and even for s , of the algorithm. These results significantly improve over =10000 we had an average deviation of less than 6% previous work [20, 8]. Since the space complexity depends (taken over all but the largest instance for which we could only on the structure of the input graph and not on the num- not compute the number of triangles exactly). ber of nodes, our algorithms scale very well with increasing Categories and Subject Descriptors: H.3 [Information graph size and so they provide a basic tool to analyze the Systems]: Information Storage and Retrieval structure of large graphs. They have many applications, for General Terms: Algorithms, Theory, Performance. example, in the discovery of Web communities, the computa- Keywords: Streaming algorithms, graph algorithms, net- work analysis. ∗This work was partially supported by the EU within the 6th Framework Programme under contract 001907 “Dynam- ically Evolving, Large Scale Information Systems” (DELIS) 1. INTRODUCTION ∗ Part of this work was done while the author was post-doc Graphs are fundamental structures for modeling complex at Universit´a degli Studi di Roma “La Sapienza” relationships between data in Web documents, chemical com- † Part of this work was done while the author was visiting the pounds, XML, social networks etc. A basic tool to uncover School of Computer Science at Carnegie Mellon University their structural design principles and to extract relevant in- formation is to mine the most frequent interconnection pat- terns occurring in the graph. The computation of network indices based on counting the Permission to make digital or hard copies of all or part of this work for number of certain small subgraphs is a basic tool in the anal- personal or classroom use is granted without fee provided that copies are ysis of the structure of large networks. The clustering coeffi- not made or distributed for profit or commercial advantage and that copies cient [18] is defined as the normalized sum of the fraction of bear this notice and the full citation on the first page. To copy otherwise, to neighbor pairs of a vertex of the graph that are connected. republish, to post on servers or to redistribute to lists, requires prior specific The related transitivity coefficient of a graph [6], is defined permission and/or a fee. PODS’06, June 26–28, 2006, Chicago, Illinois, USA. as the ratio between three times the number of triangles and Copyright 2006 ACM 1-59593-318-2/06/0006 ...$5.00. the number of length two paths in the graph. More recently, 253 much attention has been devoted to the analysis of complex The algorithms are obtained through a so called ”list” effi- networks arising in information systems, software systems, cient reduction to the problem of computing frequency mo- overlay networks etc. Mining the most frequent subgraphs is ments [1]. Subsequently, more algorithms have also been here aimed to identify the building blocks of universal classes developed for the adjacency stream model [8]. These solu- of complex networks [14]. As an example, the occurrence of tions are still far from being practical for most real world a very large number of certain dense subgraphs has been networks. observed in the Webgraph, the graph formed by Web pages and hyperlinked connections [10], in the attempt of trac- 1.1 Our contribution ing the emergence of hidden cyber-communities. A stochas- In this work we specifically present unbiased estimators tic model of the growth of the Webgraph [9], the ”copying for the number of triangles in the graph and the number of model”, has these dense subgraphs as building blocks of the cliques of any size. Our data stream algorithms compute a process of network formation. (1 + )-approximation with probability 1 − δ.Acomplete Finding frequent graph patterns also finds application to overview of the application of our method to other classes graph databases where the classical graph query problem of subgraphs will be given in the full version of our work. consists of finding all the graphs of the database containing When estimating the number of triangles, if the graph is a given query pattern as a subgraph. A direct indexing of given as a stream of edges in arbitrary order, the data struc- 1 1 |T1|+|T2| the most frequent subgraphs, up to a maximum size, that O 2 · · Ti ture uses ( log( δ ) (1+ |T3| )) memory cells, where occur in the graph [19] has for instance been proposed as an denotes the set of node-triples having i edges in the induced alternative to path indexing [16]. subgraph. |T3| is therefore the measure we like to estimate. Counting the number of certain subgraphs in a large graph This is always better than the naive sampling algorithm that is a challenging computational task. The current state of 1 1 |T0|+|T1|+|T2| requires O( 2 log( )(1+ )) memory cells, while the art provides methods that are either computational in- δ |T3| it dramatically improves by a cubic factor the solution pro- feasible on large data sets or do not provide any guarantee vided in [20]. Comparing our results in this model with the on the accuracy of the estimation. The best known meth- previous work in [8], we obtain a one-pass algorithm that ods for the solution of the simplest non trivial version of achieves the same space bound and better update time as this problem, i.e. counting the number of triangles in a the three pass algorithm from [8]. The two other algorithms subgraph, reduces to matrix multiplication [3]. This is not in [8] either require bounded maximum degree or are incom- computational feasible even on graphs of medium size, be- parable to our result because the space complexity depends cause of time complexity and the space required to store on different parameters (e.g., thenumberofcyclesoflength the whole graph and the related data structures in main 4 and 6 in the graph). The number of memory cells used memory. Schank and Wagner [15] give an extensive experi- by our algorithm still depends on the cardinality of T ,that mental study of the performance of algorithms for counting 1 can be as large as O(|E|·|V |). Our method in the case of and listing triangles in graphs. graphs in arbitrary order is therefore of practical interest for A natural way to address the problem of computing with networks with a large enough number of triangles. massive data sets is to resort to the data stream model [7, Of greater practical relevance is our method when the 12]. In this model data arrives in a stream, one item at graph is given as an incidence stream. The number of mem- a time, and the algorithms are required to use very little 1 1 ory cells used by our data structure is O( 2 log( )log(|V |)(1+ space and per-item processing time. Secondary and slower δ |T2| memory storage devices naturally produce data streams for |T3| )). To give a flavor of the quality of our result, observe which multiple passes of computation are usually prohibitive |T3| / that |T2| is exactly equal to 1 3oftheinverseofthetransi- due to the volumes of stored data. In several network con- tivity coefficient of the graph, a universal measure closely re- texts, the application receive data without pace from remote lated to the clustering coefficient, whose value for networks sources. Data stream computation allows also to compute of practical interest is hardly bigger than 105. Therefore, on-line relevant quantities without incurring a large cost for the number of memory cells of our data structure depends, organizing and storing data.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us