Project Lab 3
Assignment : C by example. Part II: Graph data structure
- Download the file inputGraph.c
- inputGraph.c now gets a graph file and fills the data in
adjacency list format and prints the adjacency list.
- To compile inputGraph.c do
make
- To see how it works do
./inputGraph -f ErdosRenyi10-20-1.gr - Write the following funtions:
- Write a function
int edge(int i, int j)
that outputs 1 if node i is adjacent to j and 0 otherwise
- Write a function
void printAdjacencyMatrix()
that outputs the adjacency matrix.
- Write a function
void degreeDistributioon()
that outputs a function f(i)=number of nodes of degree i.
- To print a "inputGraph.c" file do
a2ps -R --column 1 inputGraph.c
Yannet Interian
Networks and Algorithms