in Programming

Installing igraph C library on Cygwin

154px-cygwin_logoI’m not an expert on this, but here I will try to explain step by step installling igraph (graph library for complex network research) on Cygwin. Citing igraph on sourceforge, igraph is a free software package for creating and manipulating undirected and directed graphs. It includes implementations for classic graph theory problems like minimum spanning trees and network flow, and also implements algorithms for some recent network analysis methods, like community structure search. Those, windows user, who need this package the most might be interested to use and compile it using gcc via cygwin.



01. Cygwin installed. Also, make sure you have development package installed.


01. Download latest C library source code directly from it’s official sites.

Save to $cygwindir$home$user$. In my case, the latest release (igraph-0.6.5.tar.gz) is saved to C:cygwinhomewahyu.reza

02. Open Cygwin Terminal
First, change directory to saved file folder. Type these code in order

tar zxf igraph-0.6.5.tar.gz
cd igraph-0.6.5
make install

03. Try compiling your first code.

Open your fav text editor. Paste this code below and save as igraph_test.c to $cygwindir$home

Back to Cygwin Terminal, type this

gcc igraph.c -I/home/wahyu.reza/igraph-0.6.5/ -L/home/wahyu.reza/igraph-0.6.5/src/.libs -ligraph -o igraph_test
Note: The directory after the -I switch is the one containing the igraph.h file, while the one following -L should contain the library file itself, usually a file called, libigraph.a or igraph.dll

Successful compile will result: Diameter of a random graph with average degree 5: 9


Write a Comment


  1. Hi Wahyu Reza!
    I am Thanh Thanh. Can you give me your email? I have problems with igraph C, can I ask you via email? Thank you very much!

  2. Hello Wahyu Reza!
    Please help me! When I install Cygwin, What do i install development packages ? and I already installed Cygwin, so How can i add development packages?
    Thank you very much!
    Thanh Thanh