<br> <img src="images/poster-logo-small.png" alt="G* ICDE Poster Logo" width="600"> <div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <div id="nav" class="brand" style="float:left; vertical-align:middle; line-height:36px;"> The G* Research Group </div> <div id="nav" class="brand" style="float:right;"> <a href="http://www.cs.albany.edu/~gstar/" class="btn btn-small" style="width:110px;">Home</a> <a href="http://www.cs.albany.edu/~gstar/publications" class="btn btn-small" style="width:110px;">Publications</a> <a href="http://www.cs.albany.edu/~gstar/quick-start-guide" class="btn btn-small" style="width:110px;">Quick Start Guide</a> <a href="http://www.cs.albany.edu/~gstar/operator-reference" class="btn btn-small" style="width:110px;">Operator Reference</a> <a href="http://www.cs.albany.edu/~gstar/request-form" class="btn btn-small" style="width:110px;">Request Form</a> </div> </div> </div> </div> # Quick Start Guide In this document, we use the following conventions: * ```bash These are command line interface commands. ``` * `These are G-star Terminal commands.` > [Terminal] Responses from a G-Star Terminal look like this. > [Master] Responses from the G-Star Master look like this. > [Worker 0] Responses from a G-Star Worker look like this. - - - ## Set Up Copy the _gstar.jar_ file you received from us to every computer on which you wish to run G*. ### 1. Start the Master Open a new command line interface window if necessary. Start the Master server. For this example, we'll configure the Master to work with two (2) workers and use port 2112. ```bash java -cp gstar.jar gstar.Master -workers 2 -port 2112 ``` >[Master] gstar.Master is waiting to be contacted by 2 Workers. * `2` is the number of worker connections the Master expects. * `2112` is the port used by the Master. - - - ### 2. Run the Workers Now, we need workers to connect to the Master server. (Two of them, actually.) #### Worker 0 ### Open another command line interface window, if necessary. Run the initial worker with ID `0` on port `2000`, connecting to the Master on `127.0.0.1:2112`. ```bash java -cp gstar.jar gstar.Worker 0 2000 127.0.0.1:2112 ``` >[Worker 0] gstar.Worker(0) started its graph manager and query engine. >[Master] gstar.Master registered Worker 0. * `0` is the worker ID. * `2000` is the port on which Worker 0 resides. * `127.0.0.1:2112` is the address of the Master. #### Worker 1 ### Open yet another command line interface window if necessary. Run the next worker with ID `1` on port `2001` connecting to the master server on `127.0.0.1:2112`. ```bash java -cp gstar.jar gstar.Worker 1 2001 127.0.0.1:2112 ``` >[Worker 1] gstar.Worker(1) started its graph manager and query engine. >[Master] gstar.Master registered Worker 1. >[Master] gstar.Master registered 2 Workers. * `1` is the worker ID. * `2001` is the port on which Worker 1 resides. * `127.0.0.1:2112` is the address of the Master. - - - ### 3. Open a G&#42; Terminal <!-- I really, REALLY think we should call this the G-star Console. --> Open one more command line interface window, if necessary. Finally, start the G&#42; Terminal on port `2113` (for example) to interact with the Master at `127.0.0.1:2112`. ```bash java -cp gstar.jar gstar.Terminal 2113 127.0.0.1:2112 ``` >[Terminal] Welcome to G&#42; version 1.0.0. >[Terminal] G&#42;$ * `2113` is the port that the Terminal uses. * `127.0.0.1:2112` is the address of the Master. - - - <br> <br> ## Using G&#42;: Examples For a complete list of commands, please refer to the [G&#42; Terminal Command Reference](#command_ref) ### Creating Graph Data Assuming you are starting from a clean slate (i.e., no existing data) and have started the Master and two workers as described above, and are running a Terminal . . . * `pwd` >[Terminal] / * `mkdir altair` >[Terminal] \altair created on 2 workers. * `ls` >[Terminal] altair # directory containing 0 graphs on 2 workers * `cd altair` >[Terminal] moved to /altair * `graph 0` >[Terminal] graph 0.0 is in /altair. >[Master] gstar.Master has created an empty graph 0.0. * `string state` >[Terminal] state # string type attribute * `int year` >[Terminal] year # int type attribute * `ls` >[Terminal] state # string type attribute >[Terminal] year # int type attribute >[Terminal] 0.0 # graph containing 0 vertices and 0 edges * `vertex a state="NY" year=1968` >[Terminal] (_no response_) >[Master] graph 0.0 has 1 vertices and 0 edges. * `vertex b state="CT" year=2006` >[Terminal] (_no response_) >[Master] graph 0.0 has 2 vertices and 0 edges. * `double weight` >[Terminal] weight # double type attribute * `edge a b weight=42.007` >[Terminal] (_no response_) >[Master] graph 0.0 has 2 vertices and 1 edges. * `graph 1 0` >[Terminal] graph 1.0 is in /altair. >[Master] gstar.Master has created graph 1.0 which contains 2 vertices and 1 edges. * `ls` >[Terminal] state # string type attribute >[Terminal] weight # double type attribute >[Terminal] year # int type attribute >[Terminal] 0.0 # graph containing 2 vertices and 1 edges >[Terminal] 1.0 # graph containing 2 vertices and 1 edges * `edge b c weight=867.5309` >[Terminal] (_no response_) >[Master] graph 1.0 has 3 vertices and 2 edges. * `ls` >[Terminal] state # string type attribute >[Terminal] weight # double type attribute >[Terminal] year # int type attribute >[Terminal] 0.0 # graph containing 2 vertices and 1 edges >[Terminal] 1.0 # graph containing 3 vertices and 2 edges These commands may be piped into a G&#42; terminal from a text file (e.g., _input.txt_) as follows: ``` cat input.txt | java -cp gstar.jar gstar.Terminal 2113 127.0.0.1:2112 ``` <br> <a id="query_examples"></a> ### Querying Graph Data Assuming you are continuing from the example above . . . * `operator vertex@* = VertexOperator([], [0,1])` >[Terminal] (_no response_) >[Master] gstar.Master has created vertex@*. * `operator union@0 = UnionOperator([vertex@*])` >[Terminal] (_no response_) >[Master] gstar.Master has created union@0. * `run union@0` >[Terminal] {id=b, incoming_edges={a={weight=42.007}}, outgoing_edges={}, state=CT, year=2006, graph.id=[0.0]} >[Terminal] {id=b, incoming_edges={a={weight=42.007}}, outgoing_edges={c={weight=867.5309}}, state=CT, year=2006, graph.id=[1.0]} >[Terminal] {id=a, incoming_edges={}, outgoing_edges={b={weight=42.007}}, state=NY, year=1968, graph.id=[0.0, 1.0]} >[Terminal] {id=c, incoming_edges={b={weight=867.5309}}, outgoing_edges={}, graph.id=[1.0]} Note that the `vertex` and `union` operators are removed from the workers after the query completes. To re-run the query, you will first have to redefine the `vertex` and `union` operators. See the [G&#42; Operator Reference](http://www.cs.albany.edu/~gstar/operator-reference "G* Operator Reference") for query operator details and examples. #### Advanced Queries * Find the vertex degree distribution for each graph, where graph ID is 0, 1, 2, 3, or 4. ``` operator vertex@* = VertexOperator([], [0:1:4]) operator out_degree@* = ProjectionOperator([vertex@local], [id, graph.id, cardinality(outgoing_edges)], [id, graph.id, out_degree]) operator partial_count@* = AggregateOperator([out_degree@local], [count], [*], [count], [graph.id, out_degree]) operator union@0 = UnionOperator([partial_count@*]) operator total_count@0 = AggregateOperator([union@local], [sum], [count], [count], [graph.id, out_degree]) operator sort@0 = SortOperator([total_count@local], [graph.id, out_degree:desc]) run sort@0 ``` * Find the size of the three largest weakly connected components in each graph, where graph ID is 0, 1, 2, 3, or 4. ``` operator comp_id@* = WeakComponentIDOperator([], [0:1:4], comp_id) operator partial_count@* = AggregateOperator([comp_id@local], [count], [*], [count], [graph.id, comp_id]) operator union@0 = UnionOperator([partial_count@*]) operator total_count@0 = AggregateOperator([union@local], [sum], [count], [size], [graph.id, comp_id]) operator top_k@0 = TopKOperator([total_count@local], 3, [size:desc, comp_id], [graph.id]) operator sort@0 = SortOperator([top_k@local], [graph.id, size:desc, comp_id]) run sort@0 ``` * Find the three vertices with the largest change in degree over consecutive graph snapshot pairs as the graph ID goes from 0 to 4 in increments of 1. (I.e., compare graphs 0 and 1, graphs 1 and 2, and so on.) ``` operator vertex1@* = VertexOperator([], [0:1:4]) operator degree1@* = ProjectionOperator([vertex1@local], [id, graph.id, cardinality(outgoing_edges)], [id, graph.id, degree]) operator partial1@* = AggregateOperator([degree1@local], [sum], [degree], [degree], [id, graph.id]) operator vertex2@* = VertexOperator([], [1:1:5]) operator degree2@* = ProjectionOperator([vertex2@local], [id, graph.id, cardinality(outgoing_edges)], [id, graph.id, degree]) operator partial2@* = AggregateOperator([degree2@local], [sum], [degree], [degree], [id, graph.id]) operator partial3@* = ProjectionOperator([partial2@local], [id, graph.id-1, degree], [id, graph.id, degree]) operator join@* = JoinOperator([partial1@local, partial3@local], [id, graph.id], [id, graph.id]) operator diff_degree@* = ProjectionOperator([join@local], [right.graph.id, right.id, right.degree-left.degree], [graph.id, id, diff_degree]) operator union@0 = UnionOperator([diff_degree@*]) operator topk@0 = TopKOperator([union@local], 3, [diff_degree:desc, id], [graph.id]) operator sort@0 = SortOperator([topk@local], [graph.id, diff_degree:desc, id]) run sort@0 ``` See the [G&#42; Operator Reference](http://www.cs.albany.edu/~gstar/operator-reference "G* Operator Reference") for query operator details and examples. <br> <br> <a id="command_ref"></a> ## G&#42; Terminal Command Reference ##### Graph Directory Management * `pwd` Print the current working graph directory. (This is not the same as the directory in your file system.) * `ls` List the contents of the current graph directory. * `mkdir <dir_name>` Create a new graph directory called `<dir_name>` on all workers. * `rmdir <dir_name>` Remove the contents of the graph directory called `<dir_name>`. <!-- * `mkdir <dir_name>/1worker@0` Create a new graph directory called `<dir_name>` with access to one worker, specifically worker `0`. * `mkdir <dir_name>/<n>workers@ 0-<n>` Create a new graph directory called `<dir_name>` with access to `n` workers, `0` through `n`. --> * `cd <dir_name>` Change the current working graph directory to `<dir_name>` if it's in scope. ##### Data Types * `string <id_name>` Define a `string` type attribute called `<id_name>` (valid only in the current graph directory). * `int <id_name>` Define an `int` type attribute called `<id_name>` (valid only in the current graph directory). * `double <id_name>` Define a `double` type attribute called `<id_name>` (valid only in the current graph directory). ##### Graph Management * `graph <graph_id>` Create a graph with the specified `<graph_id>` and make it the current graph. If `<graph_id>` already exists, then it just becomes the current graph. `<graph_id>` can be a double or an integer. * `vertex <vertex_id> <attribute>=<value>` Create or replace a vertex with the specified `<vertex_id>` and set its `<attribute>` to `<value>`. You can set many attribute/value pairs in one command. * `edge <vertex_id1> <vertex_id2> <attribute>=<value>` Create or replace an edge from `<vertex_id1>` to `<vertex_id2>` and set its `<attribute>` to `<value>`. The vertices will be created if they do not currently exist. * `graph <graph_id1> <graph_id0>` Create a new graph with `<graph_id1>` by cloning `<graph_id0>`. This also sets `<graph_id1>` as the current graph. ##### Query Operators * `operator <op_name>@<worker_id | *> = <op_type>([<input_op_names>], <param_1>, <param_2>, . . .)` Create a new `<op_type>`-type operator called `<op_name>` on worker `<worker_id>` or all workers (`*`). See the [G&#42; Operator Reference](#operator_ref) for operator documentation. * `run <op_name>@<worker_id>` Execute the `<op_name>` operator at worker `<worker_id>` and all other operators that `<op_name>@<worker_id>` depends on. These operators are automatically removed after execution is complete. See the [G&#42; Operator Reference](http://www.cs.albany.edu/~gstar/operator-reference "G* Operator Reference") for query operator details and examples.

Copyright © 2013-2014 The Research Foundation for The State University of New York.
All rights reserved.   Unauthorized reproduction is prohibited.