Skip to content

Commit

Permalink
shortest path QW compiles, run enron
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Patrikalakis committed Apr 7, 2016
1 parent fadc19f commit 3222088
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ target/*
/metrics
/storage
/results
/.idea/
/graphdb-benchmarks.iml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public void shortestPaths(Set<Integer> nodes) {
ctxt = shortestPathTimes.time();
try {
shortestPath(from, i);
} catch(Exception e) {
e.printStackTrace();
} finally {
ctxt.stop();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package eu.socialsensor.graphdatabases;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.TimeUnit;

import org.apache.commons.configuration.Configuration;
Expand All @@ -17,6 +10,7 @@
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Property;
Expand Down Expand Up @@ -288,12 +282,16 @@ public void shortestPath(final Vertex fromNode, Integer node)
{
final GraphTraversalSource g = graph.traversal();
final Vertex toNode = getVertex(node);
//TODO(amcp) how to limit depth to 5?
List<Path> paths = g.V(fromNode).repeat(__.both().simplePath()).until(__.is(toNode)).limit(1).path().toList();

for(Path path : paths) {
path.size();
}
// repeat the contained traversal
// map from this vertex to inV on SIMILAR edges without looping
// until you map to the target toNode and the path is six vertices long or less
// only return one path
GraphTraversal<?, Path> t =
g.V(fromNode).repeat(__.both().simplePath()).until(__.is(toNode).and(__.filter(it -> it.path().size() <= 6)))
.limit(1).path();
//when the size of the path in the traverser object is six, that means this traverser made 5 hops from the
//fromNode, a total of 6 vertices
t.tryNext().ifPresent( it -> it.size());
}

@Override
Expand Down Expand Up @@ -624,7 +622,7 @@ public Vertex nextVertex(Iterator<Vertex> it)
public Vertex getVertex(Integer i)
{
final GraphTraversalSource g = graph.traversal();
final Vertex vertex = g.V(T.label, NODE_LABEL).has(NODE_ID, i).next();
final Vertex vertex = g.V().has(NODE_ID, i).next();
return vertex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Vertex getOrCreate(String value)
{
final Long longVal = Long.valueOf(value); //the value used in data files
//the value used in data files sometimes is zero so add one for the purposes of generating ids
final Long longPositiveVal = Long.valueOf(value) + 1;
final Long longPositiveVal = longVal + 1;
//send everything to partition 1 by adding 1
final long titanVertexId =
TitanId.toVertexId((longPositiveVal << 1) + 1 /*move over 1 bit for 2 partitions (2^1 = 2)*/);
Expand Down
10 changes: 5 additions & 5 deletions src/test/resources/META-INF/input.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Choose which data sets you want to include in the benchmark by removing the contents.
#Enron
#eu.socialsensor.dataset=data/Email-Enron.txt
eu.socialsensor.dataset=data/Email-Enron.txt
#Amazon
#eu.socialsensor.dataset=data/Amazon0601.txt
#YouTube
Expand All @@ -11,7 +11,7 @@
#eu.socialsensor.actual-communities=com-lj.all.cmty.txt
#Synthetic
#can change the number in the filename of the synthetic datasets to 1000, 5000, 10000, 20000, 30000, 40000, 50000
eu.socialsensor.dataset=data/network50000.dat
#eu.socialsensor.dataset=data/network10000.dat
#eu.socialsensor.actual-communities=data/community50000.dat

eu.socialsensor.database-storage-directory=storage
Expand All @@ -32,7 +32,7 @@ eu.socialsensor.databases=ttupl
#eu.socialsensor.databases=tce
#eu.socialsensor.databases=ti
#eu.socialsensor.databases=orient
eu.socialsensor.databases=neo4j
#eu.socialsensor.databases=neo4j

# Database specific options
# Titan options
Expand Down Expand Up @@ -82,8 +82,8 @@ eu.socialsensor.benchmarks=MASSIVE_INSERTION
#eu.socialsensor.benchmarks=SINGLE_INSERTION
eu.socialsensor.benchmarks=FIND_NEIGHBOURS
eu.socialsensor.benchmarks=FIND_ADJACENT_NODES
#eu.socialsensor.benchmarks=FIND_SHORTEST_PATH
#eu.socialsensor.shortest-path-random-nodes=100
eu.socialsensor.benchmarks=FIND_SHORTEST_PATH
eu.socialsensor.shortest-path-random-nodes=100

# The clustering benchmark is not permutable even if eu.socialsensor.permute-benchmarks=true
#eu.socialsensor.benchmarks=CLUSTERING
Expand Down

0 comments on commit 3222088

Please sign in to comment.