Program The rantings of a lunatic Scientist

Adjacency Matrix

C/C++ Daily Programmer

I decided to start taking part in some of the programming challenges over at /r/dailyprogrammer. The first of which was to read in an input file representing an edge/node graph structure of the form:

5 5
0 -> 1
1 -> 2
2 -> 4
3 -> 4
0 -> 3

And to output the Adjacency Matrix of the graph in the form:

0 1 0 1 0
0 0 1 0 0
0 0 0 0 1
0 0 0 0 1
0 0 0 0 0

Below is the code of my submission. I decided to make the challenge a little more interesting using bit level operations to store the matrix in ~approx~ N*N bits rather than the usual minimum of N*N bytes.