implementing the graph with c