SNAP (Stanford Network Analysis Platform) Python
Project description
snap-python
-
Install SWIG for your platform (see below). Swig should be able to run from the command-line.
-
Checkout the snap-python repository as well as the SNAP C++ repository.
git clone git@github.com:snap-stanford/snap-python.git git clone git@github.com:snap-stanford/snap.git
-
Then, run
make
from the top-level ofsnap-python
. This will make the SNAP code into a Python module, using SWIG. Finally, it will run some Python tests in thetest
directory.cd snap-python make
From a Python interpreter, you should be able to import
snap
module:$ python >>> import sys >>> sys.path.append("swig") >>> import snap
-
There are some examples in the
examples
directory. For example, to run benchmarks:$ cd examples $ python benchmark.py -h usage: benchmark.py [-h] [-v] [-r RANGE] [-e EDGES_DEG] [-d] [-t GRAPH_TYPES] [-n NUM_ITERATIONS] [-o OUTPUT_FILE] [-g] [-w] optional arguments: -h, --help show this help message and exit -v, --verbose increase output verbosity -r RANGE, --range RANGE range (4-6) (10^4 to 10^6 nodes) -e EDGES_DEG, --edges_deg EDGES_DEG range of degrees (e.g "2-3" => (10^1 to 10^3 edges per node) -d, --deterministic deterministic benchmark -t GRAPH_TYPES, --graph_types GRAPH_TYPES Graph types, comma separated. Available: rand_ungraph, rand_ngraph, rmat, pref, sw -n NUM_ITERATIONS, --num_iterations NUM_ITERATIONS number of iterations -o OUTPUT_FILE, --output_file OUTPUT_FILE file to output results -g, --generate generate new graphs -w, --write_graph save graph $ python benchmark.py -v -g -r 4-6 # needs about 4.3GB RAM and 4 min to run
SWIG Installation
Linux
Follow the instructions from SWIG's website: download, configure and make, SWIG files. Or, use your built-in installer (a CentOS example):
sudo yum install swig
Mac OS X
swig-1.3.12 and later support OS-X/Darwin.
-
If you have
homebrew
, simply hitbrew install swig
in terminal and ignore the rest of the instructions. Otherwise, download the Unix sources, configure, and build from the command terminal. This has been tested on 10.8.2. The following is adopted from ColourBlomb. -
Download the Unix source from http://swig.org/download.html
-
Moving to the terminal, extract the files from the tarball and move to the root directory of the SWIG install:
cd /Developer/SWIG tar -xf swig-2.0.4.tar.gz cd swig-2.0.4
-
Run
./configure
. This will produce an error if you don't have the PCRE (Perl Compatible Regular Expressions) library package installed. This dependency is needed for configure to complete. Either:-
Install the PCRE developer package on your system (preferred approach).
-
Download the PCRE source tarball, build and install on your system as you would for any package built from source distribution.
-
Use the
Tools/pcre-build.sh
script to build PCRE just for SWIG to statically link against. RunTools/pcre-build.sh –help
for instructions. (quite easy and does not require privileges to install PCRE on your system) -
Configure using the
–without-pcre
option to disable regular expressions support in SWIG (not recommended). Seeconfig.log
for more details.make sudo make install
-
-
PCRE should now have successfully installed so move to the swig install directory and try
./configure
again:cd ../swig-2.0.4 ./configure
This time no errors are thrown so try and install:
make sudo make install
-
Once this has completed test that SWIG has installed correctly, type
swig
into the terminal and hopefully you’ll get the response: Must specify an input file. Use-help
for available options.
SWIG Benchmarks
Example SWIG programs using the SNAP Ringo for multi-attribute edges are in the examples
directory. The benchmark program benchmark.py
performs a series of functions on the graph data, including node/edge iteration, degree checks, clustering coefficients, largest weakly and strongest components, etc. For R-MAT graphs with 1 million nodes and 10 million edges, this takes on average:
- On CentOS 6.3 with 2.66 GHz processor, 19.71 sec to generate a new graph and and 17.49 sec to run the tests.
- On Mac OSX 10.8 with 2.6 GHz processor, 13.95 sec to generate and 15.06 sec to run the tests.
To run a benchmark test you can run the following command:
python benchmark.py --verbose -n 5 --range 4-7 --type rmat --generate
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file snap_stanford-6.0.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 750f9e35a73074add78fd1f7b86cb75b938b3cac48e10c46844cdd839bc9141a |
|
MD5 | 8bef73ceaa8117430deb0cdaea1fc4bf |
|
BLAKE2b-256 | 4f37cb8644db6b05e613dff197ce9fa341873e1fa1e2f971437c16f71f657c53 |
File details
Details for the file snap_stanford-6.0.0-cp39-cp39-manylinux1_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp39-cp39-manylinux1_x86_64.whl
- Upload date:
- Size: 11.7 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 963d62bd5bf7ccc40e14ef422bf718a03c36602b8ca698b7d3ea04d9228a455d |
|
MD5 | 3f05d7fd9523a6511f20214c38647d97 |
|
BLAKE2b-256 | 4d4cb95f99f8f38aa7c08dc96347273394fcbe43c70488f605408dfa5764f124 |
File details
Details for the file snap_stanford-6.0.0-cp39-cp39-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp39-cp39-macosx_10_14_x86_64.whl
- Upload date:
- Size: 10.8 MB
- Tags: CPython 3.9, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52420cf8f7ddc6afddba2fd7c51f94e89a2eb810d62418acef84eda725496683 |
|
MD5 | 04448aa6867151cde5b938fa9dd8c91a |
|
BLAKE2b-256 | 38e260656df9db7a326f0f15c64c63a468e019d2932ade9adf846de0c70c3a4e |
File details
Details for the file snap_stanford-6.0.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b2f5b213ef9c9c9bd070fb8cad28f38a23402f71abd21b61261088f69633a37 |
|
MD5 | 5f63a048f9be3c642166310f8c9bb3cb |
|
BLAKE2b-256 | 0cedb970b9d7647f2d5a70a68cac0ca89350b1908b41fdbe1a718562a83c05b0 |
File details
Details for the file snap_stanford-6.0.0-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d3b5ea377ac68abb8f1889a5b70c57af83a6659a6b0cfc9d064b83e74f10ead |
|
MD5 | dcfb0102a811f0aec7c408dea3b16794 |
|
BLAKE2b-256 | a7b8b7515875f298974af2688387cfcae306ad95adb820df9f3fb20b41998cef |
File details
Details for the file snap_stanford-6.0.0-cp38-cp38-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp38-cp38-macosx_10_14_x86_64.whl
- Upload date:
- Size: 10.8 MB
- Tags: CPython 3.8, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2a3aa1c2bf71be987f90e045aac1e1a7bf41cf9a59de665e68aa5b4b3c8a0e6 |
|
MD5 | daa87f855dc26b9e82d410a01c9e34a4 |
|
BLAKE2b-256 | 088eed36604711c43a43da057051e37d903764127af8a9f9742226138c3035c3 |
File details
Details for the file snap_stanford-6.0.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e25c728b13725ee46fa0a9dd38eec4a8f600eba933834f41e0085cedc17bc11 |
|
MD5 | aabe1eab905dfe827501e93afe1c86f1 |
|
BLAKE2b-256 | e6808eb75269c62475474f89c7bbaa08934fc0d846b3f15b43117c59b75f967f |
File details
Details for the file snap_stanford-6.0.0-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80ca315bbaa746af9490cfbb41e83d143d1a2d2ae48ef7a4e1d77d2b03dc7057 |
|
MD5 | 5c21dfdb2ba915901c5d8722c580fcc7 |
|
BLAKE2b-256 | 9b1176c0bbe6dbd5004ea6ae2fcd748d5d6a17f65c506b894f2de13d36918d13 |
File details
Details for the file snap_stanford-6.0.0-cp37-cp37m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp37-cp37m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 10.8 MB
- Tags: CPython 3.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fe655b49e44c8bb8605a1f4409e48a04a6907945edcd1ff78db9507636cc049 |
|
MD5 | cb350fe6b24cb5fddf4db41912a52128 |
|
BLAKE2b-256 | 3143c28adce53d2588d4aa992b2f999d9e08d56c48c290e2be6244000c6217c2 |
File details
Details for the file snap_stanford-6.0.0-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | faf9c32522415ceab334fc27a7556163fde6cfc05fc4a277e3f4aeec34b890d1 |
|
MD5 | 3eca8f7d2273da53cc23621154330006 |
|
BLAKE2b-256 | 79e3d9d4a05b2e1f5e593620c3c087f5b506a55079fb1a879ae6de93c8f275f2 |
File details
Details for the file snap_stanford-6.0.0-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41df7bf97ada5f5642e7576bfb32ed4242f09d2c2f1b7fcb65462447bd588295 |
|
MD5 | 97592901da8a9a1898e1e3e5785ee7f7 |
|
BLAKE2b-256 | 18640eb31e3383c950b771fb58e9eedc0bcefa4320e6291ed662bc4674a37542 |
File details
Details for the file snap_stanford-6.0.0-cp36-cp36m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp36-cp36m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 10.8 MB
- Tags: CPython 3.6m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34a5e05fb70f750f89e26fec06c69a84705c0644748860f6c992dde65a302e9a |
|
MD5 | 866163b13bf9800c9968c729d8b9246b |
|
BLAKE2b-256 | a66e9357ea6bf441279d85058b8783a5b84e4f1bea9b576b0ccd2478a1b33e38 |
File details
Details for the file snap_stanford-6.0.0-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cda954a4526f9f66aa2b5265bf8f2e2a0a05ec0f81fb37ef9c31450ec10d3f32 |
|
MD5 | eea182c63830a70629b6716217b78a1d |
|
BLAKE2b-256 | 77b8c98f0a803d09f2d1ea03f253402e4949b42ecab804e9525d322967195e0d |
File details
Details for the file snap_stanford-6.0.0-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93f054a2ebe783c2c11d01e21eccd0d780a199a211f5f8aec9dda3d35554f0e9 |
|
MD5 | acf193378bd20c61e7063540d994cd69 |
|
BLAKE2b-256 | 880b6247c64f567ff6c94bf4f8b7c373ff8d0fc62a748d23ae6608f731b2837d |
File details
Details for the file snap_stanford-6.0.0-cp35-cp35m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp35-cp35m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 10.8 MB
- Tags: CPython 3.5m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea5e24f6ad2eedf8604a80476ca25cff61e072e9996d4355ac71d5304495d7c8 |
|
MD5 | 0c1ff48340fed40e48563e3f67f8b5fa |
|
BLAKE2b-256 | b2e4f9defc13cbe604b4fb775c6f33cb7e78fb08cc3ef7abee88abb8206fa6c7 |
File details
Details for the file snap_stanford-6.0.0-cp27-cp27mu-manylinux1_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp27-cp27mu-manylinux1_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 2.7mu
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbeb88fbc890e4088ac7f317fa3c3e3c799432c48e25f94d286d93c61a45e235 |
|
MD5 | 7587a85a103495ff06cdae3a1c39c8ab |
|
BLAKE2b-256 | ba070e604b5408da0f862b0a3a0ca301a2215a5e2ff4856d2954262c50300fa2 |
File details
Details for the file snap_stanford-6.0.0-cp27-cp27m-win_amd64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp27-cp27m-win_amd64.whl
- Upload date:
- Size: 9.3 MB
- Tags: CPython 2.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57d191878b98a7b6801232ea5d9796add9dd7a4b41747c8752604135944685e7 |
|
MD5 | 310ced5ff4b8009d386e8511c856dad5 |
|
BLAKE2b-256 | fc940ef4de456d082bba8d68f25022bb44d6b079e33117bf2ede7e85e04562ea |
File details
Details for the file snap_stanford-6.0.0-cp27-cp27m-manylinux1_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp27-cp27m-manylinux1_x86_64.whl
- Upload date:
- Size: 11.6 MB
- Tags: CPython 2.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9769c9e7383802e5418a29d035e76019728861f3827f3f6904be6534000fd299 |
|
MD5 | 526f43956c72aa2c975bf7f21b9dada6 |
|
BLAKE2b-256 | f043bbe6d15a0d31232c52624ce5861d16c5b3487f839e812f78e3a52d1254eb |
File details
Details for the file snap_stanford-6.0.0-cp27-cp27m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: snap_stanford-6.0.0-cp27-cp27m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 10.7 MB
- Tags: CPython 2.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc7a37770cdf64ba18831363d00387cd51657db1c9942f6668a9f5b1ceb21821 |
|
MD5 | f8d027bc9432e64113a5ecac5729d4ee |
|
BLAKE2b-256 | ec792f475912000aa6f4dd82e3ed1353d7375742a7c316b1914b0ca45d22a233 |