This is a code implementation release for AFOCS, short for Adaptively Finding Overlapping Community Structure, from the paper
*****************************************************************************************
* Overlapping Communities in Dynamic Networks: Their Detection and Mobile Applications  *
* Nam P. Nguyen, Thang N. Dinh, Sindhura Tokala and My T. Thai                          *
* The 17th Int. Conf. on Mobile Computing and Networking (MOBICOM) 2011.                *
* Email: nanguyen@cise.ufl.edu                                                          *
*****************************************************************************************
Please cite the above paper if you happened to use this code in your research. Thank you!

-------------
 Instruction 
-------------
1. Input file
For AFOCS, there are two types of input file needed: the base file and the network changes containing node/edge insertions or node/edge removal.

1.1 The Base file
The input base file should be an edge list of the form "u v" where u and v are node IDs starting from 1. This edge list is of an undirected unweighted graph, so you don't need "v u" when "u v" was already in the list. PLEASE MAKE SURE THAT THE INPUT FILE DOES NOT CONTAIN DUPLICATE EDGES.
For example, the content of "input_0.txt", a sample input file can contain
1 3
5 2
8 7
8 9
7 2
.....
Normally, the base file is denoted by "<filename>_0.txt". For example, "facebook_0.txt", "network_n1000mu01_0.txt", etc. Note that there is no node/edge addition or removal in the base file.

1.2 The increasement file(s)
If your dynamic network contains n network snapshot, they should be named as "<filename>_1.txt",..., "<filename>_n.txt". For example, "facebook_1.txt", ..., "facebook_25.txt" for facebook data with 25 network snapshots. *** THIS STRUCTURE OF ADDITIONAL FILES IS REQUIRED FOR AFOCS ***.
In each of these file, the node/edge insertions or removals are indicated in each line as follows
** Node insertion: Say node 101 is inserted into the network with 5 edges (101, 13), (101, 15), (101, 17), (101, 29), (101, 20), then this event is described as
101 13
101 15
101 17
101 29
101 20

** Edge insertion: Say edge (105, 99) is inserted in to the network, then this event is described as
105 99

** Node removal: Say node 101 is removed from the network, then this event is described as
-101 0
where the negative sign triggers the removal process, and 0 means removal all adjacent edges of node 101

** Edge removal: Say edge (101, 12) is removed from the network, then this event is described as
-101 12
where the negative sign triggers the removal process, and 12 indicated the particular edge. 

2. Output file
The output file will be named with the extension _CID_AFOCS_XX" where XX is the overlapping threshold and will contain multiple rows, each of which composes a community of the input graph. For example, the content of "output_CID_AFOCS_75.txt", a sample output file can contain
1 3 5 27 8 32 91
2 4 5 23 44
4 6 8 10 23 45
.....
This means nodes 1, 3, 5, 27, 8, 32, 91 are in community #1; nodes 2, 4, 5, 23, 44 are in community #2, etc.

3. Command line
--
PLEASE MAKE SURE THAT YOU BUILD UP THE CODE AND HAVE THE EXECUTABLE FILE UPDATED BEFORE ANY EXPERIEMNT.
--
The command line should be in the form "AFOCS.exe <base_file> <num_snapshots> <overlapping_threshold>", where <base_file> is the input base file, and <overlapping_threshold> is in (0, 2).
For example:
	AFOCS.exe facebook_0.txt 25 0.70
	AFOCS.exe network_n1000mu01_0.txt 5 0.75
Executable file "afocs.exe" can be found in the either the "Release" folder (if you build it in the Release mode) or "Debug" folder (if you build it in the Debug mode). It is recommended that you use Release mode for a better time performance.

------
 Note
------
0. The code is implemented on Visual C++ Express, version 2010. We thank Microsoft for providing this software.
1. This release is limited to graphs with N=63732 nodes. If you want to analyze graphs with more than 63732 nodes and if memory allows, please change the constant MAX_N in file "prototypes.h" to the one you desired.
2. Of course, the authors expect this release is clear of bugs. However, if you find any program bugs or memory issues, please contact the corresponding author via "nanguyen@cise.ufl.edu". We highly appreciate your cooperation.
3. A real social trace that we used in the above paper are provided for your convenience in the "socialTraces" folder. Synthesized data is included in the "synthesizedNetworks" folder.
