Code Monkey home page Code Monkey logo

generateadjacency's Introduction

GenerateAdjacency

Generate adjacency for given graph.

Why this?

I found it hard to generate adjacency matrix for a large graph. When I try to make it, there comes a lot of problems such as Time Cost, Space Cost and File Too Large. After working of 4 or 5 days, there comes this job.

Good?

For input of graph with more than 300,000 nodes, this code could finish generating adjacency by cost about 40 minites, whereas my original code needs about 40+ hours to finish. And of cource, I run this on high-efficiency server.

I use 20 processes and about 150Gb memory. And get adjacency file of 10Gb.

There seems no space for modification in my view at present.

Input: edges of a graph in a file. Like

1 2

2 5

...

23432 23222

Output: adjacency number, which is sum of pow(2,x), where x is the index of connected node.

For example, we got such edges,

1 2

1 3

The indices of nodes 1, 2, 3 are 0, 1, 2.

Then the adjacency number of 1 is "pow(2,1) + pow(2,2) = 5".

Why Adjacency Number?

The file for 0/1 adjacency relationship is really huge, which can be more than tens of Gb. But in decimal pattern, the file can be less than half size.

More Explaination?

Send me e-mail please.

generateadjacency's People

Contributors

oswinguai avatar

Watchers

 avatar  avatar

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.