forked from snap-stanford/snap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/snap-stanford/snap
- Loading branch information
Showing
57 changed files
with
4,313 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include "targetver.h" | ||
|
||
#include "Snap.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
Oops, something went wrong.