Setup and configuration of the runtime environment of SNAP (Standford Network Analysis Project)

Source: Internet
Author: User

Because my girlfriend is studying complex networks, I sometimes pay attention to related knowledge in this field, and more importantly, I want to help my girlfriend to experiment in this paper. Although I do not have a deep understanding of complex networks, I am still very clear about the fact that the dependency on data and experimental results is very serious. The characteristics of this thesis in this field are that the entire article runs through experimental data, experiment data is used to describe the advantages and disadvantages of the model. On the other hand, the belief correction field I studied is basically a mathematical proof. It is undoubtedly difficult for me to have such a weak math skills. Let's talk less about the theme of this article. Snap, full name Standford Network Analysis
Project is a powerful open-source tool provided by Stanford University. This tool is mainly used for research in the complex network field, and its appearance is truly the gospel of researchers. If you have excellent programming skills and excellent English skills, please do not read this blog. This article is intended for beginners like me.

1. Go to the official snap homepage.

Good English students can directly follow the instructions on the official website to configure the content below. If you are too reluctant to read English, you can follow the steps below. This article is for this purpose.

Click to go to the snap official homepage

2. Download the source code of snap.

Click to download the snap source code

3. Download three plug-ins related to snap.

Gnuplot is a plotting plug-in that will be called in snap to draw a Statistical Chart of the properties related to a complex network, supporting 2D and 3D.

Click to go to The gnuplot official website to download the installation package

Graphviz is also a drawing plug-in. It is called in snap to draw a complex network diagram with nodes and edges.

Click to go to The graphviz official website to download the installation package

Nodexl office plug-in, this is indeed very powerful, you can directly do the graph, no longer need to program the drawing.

Click to go to The nodexl official website to download the installation package.

4. install necessary software

(1) gnuplot and graphviz must be installed. nodexl has no effect on the compilation and running of snap. The installation of gnuplot and graphviz is very simple, and the next step is all the way.

(2) As a technical hacker, I use Windows + Visual Studio 2008 environment. If you are using Linux + GCC, refer to the instructions in the official documentation ), only the installation in the former environment is described here. If Visual Studio 2008 is not installed, download and install it on your own.

(3) After Visual Studio 2008 is installed, You need to select the compiling environment and Visual C ++ for the first access. If you have installed Visual Studio 2008 and used it for C # or web development, you need to change the compiling environment. The procedure is as follows: tool-> Import and Export settings wizard-> reset all settings-> NO, only reset settings, this overwrites my current settings-> visual c ++ development settings-> complete.

5. Set system environment variables

Windows 7x64 flagship edition of my system. For more information, see below. Different Windows systems are slightly different, but the problem is not serious.

(1) Right-click the computer

(2) Click Advanced System settings

(3) Click environment variable

(4) locate path in system variables and click Edit

(5) add two paths at the end:

C: \ Program Files (x86) \ gnuplot \ bin
C: \ Program Files (x86) \ graphviz 2.28 \ bin

Note that before the last path, use the Semicolon ";" to separate any two paths, and use the English input method. The last path is not followed by the Semicolon ";". Save the settings.

6. Visual Studio 2008 Configuration

(1) decompress the downloaded snap-1.10 file and you can see the internal composition as follows:

Here is a brief description of the folders used in this article and their functions. The examples folder is a visual Studio solution, which includes examples of functions and snap. Although both are console applications, they are powerful enough. The three folders glib-core, snap-ADV, and snap-core are class libraries and need to be introduced into the project. The specific introduction method will be described later.

(2) Open the examples folder.


(3) Open the solution

(4) There are many projects. Click a project. Each project corresponds to a function of NSAP. Here, the motifs project is used as an example to describe the configuration operation.

First, select the motifs project, project-> properties-> Configure properties-> General-> default project-> Character Set-> select "use multi-Byte Character Set", and click "OK. This operation must be performed on each project.

Second, tools-> options-> projects and solutions-> VC ++ directories-> select "include files" in the "directory where the content is displayed" (do not ignore it here, directory inclusion error)-> added three folders: Snap-core, snap-ADV, and glib-core. You only need to perform this operation once.

Finally, compile and run the project.

7. Function Testing

(1) execute the program in the command line

After compilation and running, you will find that the console applications flash through, because these console applications all need to run with parameters. The console application is called manually in the command line. The advantage is that you do not have to worry that the console will be closed, and the records of the program execution process are easy to view. The steps are as follows:

First, copy the three files, motifs.exe, motifs. ilk, and motifs. PDB, in snap-1.10/examples/debug(if your compilation is release.zip.

Create a folder named motifs on the desktop and paste the three files into the folder. Then, copy as20graph.txt under snap-1.10/examplesto the motifs folder. Next, open the command line:
Enter CD desktop/motifs
Enter
Motifs.exe
Enter

The error message indicates that the as20graph.txt file cannot be opened. Because no parameter is added during the execution of motifs.exe, the default path of the./as20graph.txt file is incorrect. However, this operation error shows the specific usage of the parameter, so we have the following command:

Enter motifs.exe-I: as20graph.txt-M: 3-D: T-O: kbawyg
Enter

In the motifs folder, many files are generated:

This function is used to find subgraphs in a complex network. Each subgraph structure has two files. Open a GIF file and you can see it in your browser.


8. Summary

After one afternoon and one night of hard work, I finally figured out snap, and I can see its powerful functions. I hope it will help beginners who want to experiment and analyze it with snap. Other functions of snap are used in a similar way. You can try it out. After a long time of hard work, I thought this was indeed very good and powerful, and I have full respect for Stanford and the Open Source spirit.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.