public class Scott
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Algorithm |
DIRECTED
Algorithm binding for Scott that accepts directed graphs as input.
|
static Algorithm |
UNDIRECTED
Algorithm binding for Scott that only accepts undirected graphs as input.
|
Constructor and Description |
---|
Scott() |
Modifier and Type | Method and Description |
---|---|
private static long[] |
readTimes(java.lang.Process scott)
Reads the final runtime measurements from the Scott subprocess.
|
private static long[] |
runDirected(dev.roanh.gmark.util.Graph<dev.roanh.gmark.conjunct.cpq.QueryGraphCPQ.Vertex,dev.roanh.gmark.core.graph.Predicate> graph)
Runs Scott on a directed input graph.
|
private static long[] |
runUndirected(dev.roanh.gmark.util.Graph<dev.roanh.gmark.conjunct.cpq.QueryGraphCPQ.Vertex,dev.roanh.gmark.core.graph.Predicate> input)
Runs Scott on an undirected input graph that is constructed
from the given input graph by the undirected transform
GraphUtil.toUndirectedGraph(Graph) . |
private static java.lang.Process |
startSession(java.lang.String entrypoint)
Starts a new Scott process and returns it.
|
private static <T> void |
writeEdges(java.io.PrintWriter out,
java.util.List<dev.roanh.gmark.util.Graph.GraphEdge<T,dev.roanh.gmark.core.graph.Predicate>> edges)
Writes the given list of edges to the given writer
in a format that can be parsed by Scott.
|
public static final Algorithm DIRECTED
public static final Algorithm UNDIRECTED
private static long[] runUndirected(dev.roanh.gmark.util.Graph<dev.roanh.gmark.conjunct.cpq.QueryGraphCPQ.Vertex,dev.roanh.gmark.core.graph.Predicate> input)
GraphUtil.toUndirectedGraph(Graph)
.input
- The graph to run Scott on.private static long[] runDirected(dev.roanh.gmark.util.Graph<dev.roanh.gmark.conjunct.cpq.QueryGraphCPQ.Vertex,dev.roanh.gmark.core.graph.Predicate> graph)
graph
- The graph to run Scott on.private static long[] readTimes(java.lang.Process scott) throws java.io.IOException
scott
- The Scott subprocess to read from.java.io.IOException
- When an IOException occurs.private static <T> void writeEdges(java.io.PrintWriter out, java.util.List<dev.roanh.gmark.util.Graph.GraphEdge<T,dev.roanh.gmark.core.graph.Predicate>> edges)
T
- The vertex data type.out
- The writer to write to.edges
- The edges to write.private static java.lang.Process startSession(java.lang.String entrypoint) throws java.io.IOException
entrypoint
- The Python script to run. Either
'undirected' or 'directed'.java.io.IOException
- When an IO exception occurs.