Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/snap-stanford/snap
Browse files Browse the repository at this point in the history
  • Loading branch information
vid-koci committed Sep 5, 2017
2 parents 9210500 + 73cea49 commit 3e0df99
Show file tree
Hide file tree
Showing 57 changed files with 4,313 additions and 277 deletions.
5 changes: 5 additions & 0 deletions Credits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Nikhil Khadke
Vikesh Khanna
Emmanouil Kiagias
Myunghwan Kim
Vid Kocijan
Saachi Jain
Jason Jong
Peter Lofgren
Stephen Macke
Expand All @@ -33,6 +35,7 @@ Julian McAuley
Morteza Milani
Riyad Parvez
Yonathan Perez
Mohana Prasad
Rohan Puttagunta
Martin Raison
Sheila Ramaswamy
Expand All @@ -42,13 +45,15 @@ Davide Sardina
Christoph Schaefer
Pararth Shah
Nicholas Shelly
Klemen Simonic
Guo Tai
Ming Han Teh
Ba-Quan Truong
Utkarsh Upadhyay
Theodore Vasiloudis
Viswajith Venugopal
Jaewon Yang
Hao Yin
David Zeng
Chenguang Zhu
Ziga Zupanec
Expand Down
2 changes: 1 addition & 1 deletion Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ifeq ($(UNAME), Linux)
else ifeq ($(UNAME), Darwin)
# OS X flags
CC = g++
CXXFLAGS += -std=c++98 -Wall
CXXFLAGS += -std=c++98 -Wall -Wno-unknown-pragmas
CXXFLAGS += -O3 -DNDEBUG
CLANG := $(shell g++ -v 2>&1 | grep clang | cut -d " " -f 2)
ifneq ($(CLANG), LLVM)
Expand Down
2 changes: 2 additions & 0 deletions ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ Description of examples:
Estimates Kronecker graph parameter matrix.
krongen :
Generates Kronecker graphs.
localmotifcluster :
Implements a local method for motif-based clustering using MAPPR.
lshtest :
Implements locality sensitive hashing.
magfit :
Expand Down
69 changes: 69 additions & 0 deletions Release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,75 @@ performance system for graph and network manipulation and analysis

This file contains a high-level description of changes in SNAP releases.

Release 4.0, Jul 27, 2017

This is a major release and brings significant new functionality: local
higher-order clustering, counting of temporal motifs, node embedding with
node2vec, locality sensitive hashing, K nearest neighbor graph construction,
fast object loading using memory mapped files, and sparse attributes.

Here is a detailed list:

- implemented local higher-order clustering, see examples/localmotifcluster
- implemented counting of temporal motifs, see examples/temporalmotifs
- implemented node embedding with node2vec, see examples/node2vec
- implemented locality sensitive hashing, see examples/lshtest
- implemented K nearest neighbor graph construction, see
examples/knnjaccardsim
- implemented methods for computing biased random walks, required for node2vec
- implemented fast loading of objects using a memory mapped files via shared
memory for the following classes: TVec, TStrPool, TBigStrPool, THashKeyDat,
THash, TStrHash, TUNGraph, TNGraph, TMMNet, TNEANet, TNodeNet, TNodeEDatNet,
TNodeEdgeNet, TUndirNet, TDirNet, TTable, TTableContext
- implemented a shared-memory class TShMIn for input stream objects
- implemented sparse attributes (vector rather than hash based) in TMMNet and
TNEANet
- implemented a backward compatible load function TNEANet::Load_V2()
- implemented a method to convert a dense network to sparse
TNEANet::ConvertToSparse()
- implemented node2vec for TNEANet, TNGraph, and TNodeEDatNet
- defined a number of new vector and hash classes
- implemented base TNum class for integer based classes
- implemented a class for 64-bit integers TInt64
- expanded TVVVec to work with 64-bit integers
- expanded TVVec to work with 64-bit integers
- changed API for centrality calculations so that IsDir is the last parameter
- improved the code for betweenness centrality for directed graphs
- implemented AddNodeUnchecked() for TNodeNet, TNodeEDatNet, TNodeEdgeNet,
TNEANet, TUndirNet, TDirNet
- implemented SortNodeAdjV() for TUndirNet, TDirNet
- implemented TAttr::Load() to work with sparse attributes
- fixed a division by 0 in TTable::FillBucketsByWindow()
- fixed a bug in GenRewire() for directed graphs
- fixed a problem in GetGraphAnf(), dist=1 was redundant
- fixed a negative index error in casc.cpp
- fixed incorrect GCC_ATOMIC to better support ToNetwork() on Windows
- fixed a possible infinite loop in GetRndEdgeNonAdjNode()
- fixed node2vec crashing on directed graphs
- fixed and optimized TMMNet::ToNetworkMP
- added assertions for preventing writing to read only objects
- added a test for GenRwire()
- added tests for fast loading from shared memory
- added tests for jaccard similarity
- improved printing of 64-bit values
- renamed AddAtm() to AddMP()
- replaced GetMn() with explicit code to enable compilation in Snap.py
- removed profiling code from GetTriangleCnt()
- removed a redundant openmp flag from Makefile
- removed dependency of table.h on centr.h
- moved MapPageRank() and MapHits() from table.h to centr.h
- moved GetMapPageRank() and GetMapHitsIterator() from table.h to centr.cpp
- made edits for the code to compile with gcc on Mac OS X 10.9 and clang on
macOS 10.12
- updated code for compilation of Snap.py on Windows
- commented out obsolete GetMergeSortedV()
- commented out CountTriangles(), a previous implementation of
GetTriangleCnt()
- commented out dummy definitions of TNGraphMP, TNEANetMP
- fixed a few documentation typos in alg.h
- fixed a minor typo in agm comments
- edited ReadMe.txt to use only ASCII characters

Release 3.0, Jul 18, 2016

This is a mega large release. It brings major new functionality: relational
Expand Down
18 changes: 12 additions & 6 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

all: MakeAll

MakeAll:
MakeAll:
$(MAKE) -C agmfit
$(MAKE) -C agmgen
$(MAKE) -C bigclam
$(MAKE) -C cascades
$(MAKE) -C cascadegen
$(MAKE) -C cascades
$(MAKE) -C centrality
$(MAKE) -C cesna
$(MAKE) -C circles
Expand All @@ -23,13 +23,16 @@ MakeAll:
$(MAKE) -C graphhash
$(MAKE) -C infopath
$(MAKE) -C kcores
$(MAKE) -C knnjaccardsim
$(MAKE) -C kronem
$(MAKE) -C kronfit
$(MAKE) -C krongen
$(MAKE) -C localmotifcluster
$(MAKE) -C lshtest
$(MAKE) -C magfit
$(MAKE) -C maggen
$(MAKE) -C mkdatasets
# 'motifcluster' compilation skipped by default, it requires ARPACK
# 'motifcluster' compilation skipped by default, it requires ARPACK
#$(MAKE) -C motifcluster
$(MAKE) -C motifs
$(MAKE) -C ncpplot
Expand All @@ -41,13 +44,13 @@ MakeAll:
$(MAKE) -C rolx
$(MAKE) -C temporalmotifs
$(MAKE) -C testgraph


clean:
$(MAKE) clean -C agmgen
$(MAKE) clean -C agmfit
$(MAKE) clean -C bigclam
$(MAKE) clean -C cascades
$(MAKE) clean -C cascadegen
$(MAKE) clean -C cascades
$(MAKE) clean -C centrality
$(MAKE) clean -C cesna
$(MAKE) clean -C circles
Expand All @@ -61,9 +64,12 @@ clean:
$(MAKE) clean -C graphhash
$(MAKE) clean -C infopath
$(MAKE) clean -C kcores
$(MAKE) clean -C knnjaccardsim
$(MAKE) clean -C kronem
$(MAKE) clean -C krongen
$(MAKE) clean -C kronfit
$(MAKE) clean -C krongen
$(MAKE) clean -C localmotifcluster
$(MAKE) clean -C lshtest
$(MAKE) clean -C magfit
$(MAKE) clean -C maggen
$(MAKE) clean -C mkdatasets
Expand Down
11 changes: 11 additions & 0 deletions examples/knnjaccardsim/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Makefile for this SNAP example
# - modify Makefile.ex when creating a new SNAP example
#
# implements:
# all (default), clean
#

include ../../Makefile.config
include Makefile.ex
include ../Makefile.exmain
8 changes: 8 additions & 0 deletions examples/knnjaccardsim/Makefile.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# configuration variables for the example

## Main application file
MAIN = knnjaccardsim
DEPH =
DEPCPP =

26 changes: 26 additions & 0 deletions examples/knnjaccardsim/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
========================================================================
knnjaccardsim: KNN Jaccard Similarity
========================================================================

The example finds K nearest neighbor for every source node in the graph based
on jaccard similarity and returns it as a PNEANet graph.
Input: a table, src & dst node indexes in the table schema such that they
form a bipartite graph, K.
Node format in the input file name is as follows:
<src> <dst>
<src> is the source node, <dst> is the destination node.
They form a bipartite graph.

/////////////////////////////////////////////////////////////////////////////
Parameters:

/////////////////////////////////////////////////////////////////////////////
Usage: ./knnjaccardsim <filename> <K>

/////////////////////////////////////////////////////////////////////////////
Output: three columns giving edges with the K nearest neighbors and the
edge similarity score

Example:
knnjaccardsim reality.txt 3

39 changes: 39 additions & 0 deletions examples/knnjaccardsim/knnjaccardsim.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "stdafx.h"
#include "Snap.h"
#include<iostream>
using namespace std;

const std::string currentDateTime() {
time_t now = time(0);
struct tm tstruct;
char buf[80];
tstruct = *localtime(&now);
// Visit http://en.cppreference.com/w/cpp/chrono/c/strftime
// for more information about date/time format
strftime(buf, sizeof(buf), "%Y-%m-%d.%X", &tstruct);

return buf;
}

int main(int argc,char* argv[]) {
TTableContext Context;
//Create schema
//Input File Format Source,Dest,Start_Time,Duration
Schema TimeS;
TimeS.Add(TPair<TStr,TAttrType>("Source",atInt));
TimeS.Add(TPair<TStr,TAttrType>("Dest",atInt));
PTable P = TTable::LoadSS(TimeS,argv[1],&Context,' ');
int K = atoi(argv[2]);
cerr<<"Table Loaded "<<currentDateTime()<<endl;
PNGraph G = GetBiGraph(P, 0, 1);
cerr<<"Graph Generated "<<currentDateTime()<<endl;
#ifdef GCC_ATOMIC
PNEANet KNN = KNNJaccardParallel(G, K);

for (TNEANet::TEdgeI EI = KNN->BegEI(); EI < KNN->EndEI(); EI++ ){
cout<<EI.GetSrcNId()<<" "<<EI.GetDstNId()<<" "<<KNN->GetFltAttrDatE(EI.GetId(), "sim")<<endl;
}
#endif
return 0;
}

8 changes: 8 additions & 0 deletions examples/knnjaccardsim/reality.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
1 10
1 11
2 10
2 11
2 12
3 11
3 12
4 10
8 changes: 8 additions & 0 deletions examples/knnjaccardsim/stdafx.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// bigclam.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
5 changes: 5 additions & 0 deletions examples/knnjaccardsim/stdafx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#include "targetver.h"

#include "Snap.h"
13 changes: 13 additions & 0 deletions examples/knnjaccardsim/targetver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.

// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif

Loading

0 comments on commit 3e0df99

Please sign in to comment.