Giter Club home page Giter Club logo

triangle-counting's Introduction

Vertex-wise-triangle-counting

Counting number of triangles that each node contributes to in large sparse matrices. For this algorithm we use large sparse matrices with in CSC or CSR format only!

~ Function V3 ~

The logic followed in function V3 is as follows. First we access the nodes-rows (row_ptr table) and their corresponding column elements (col_index). For each possible col_index data pair of a given node, a search is started in the line, the pointer of which is defined by the first element of the pair. Searhing the data col_index contained in the respective row-node, if we locate its second component pair, we have proven the existence of a triangle, and the appropriate pointers increase. For example, lets say node zero is adjacent to the elements {1, 2, 3, 4}. For pair (1,2), a pointer will be referenced in line 1 and will access its col_index data. In case the second element of the pair is also located on the new line (line 1), there is a connection of nodes (0-1), (0-2), (1-2) therefore they participate in a triangle.

~ Function V4 ~

The algorithm that implements V4 follows a similar logic to V3 with respect to accessing nodes, indirectly using array multiplication for finding the node contribution to existing triangles. This time we receive every pair of neighboring nodes, and look for the number of their common col_index elements. Considering the above example, node zero is adjacent to node 1, so our pointer will access the col_index table data corresponding to the row 1, counting the common neighbors of the nodes (0,1). This result expresses substantially the number of non-zero existing multiplications (Hadamard product), therefore the final value of the index will be indicated in c3 [0,1]. The algorithm uses merge function to compare lists of neighboring nodes in order to significantly reduce complexity. The process continues for all neighbors of node zero, ending in the calculation of c3 [0, {1,2,3,4}] by summing the individual c3 [0, x] and repeating the same for all of them remaining nodes.

~ Code Weaknesses ~

none detected

triangle-counting's People

Contributors

kpetridis24 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

triangle-counting's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.