Quick Start
This Quick Start guides you through the steps to create a graph using the rel:graphlib
module.
Create a Binary Edge Set
A graph is represented as a module containing node
and edge
relations.
See Graphs: Schema for complete details about the graph schema.
Constructors for both directed and undirected graphs are provided.
Use a Graph Constructor
You can create graphs with the correct schema by applying one of the graph constructor template modules to a binary edge relation.
Instantiate rel:graphlib
You can run algorithms on graphs using the rel:graphlib
module, which is always instantiated on a specific graph:
// read query
// Create a binary edge set.
def my_edges = {(1, 2); (1, 3); (2, 3)}
// Construct a directed graph from my_edges using the directed_graph constructor.
def my_graph = directed_graph[my_edges]
// Instantiate rel:graphlib on my_graph.
@inline
def my_graphlib = rel:graphlib[my_graph]
// Display the PageRank of every node in my_graph.
def output = my_graphlib:pagerank
Instantiating rel:graphlib
without @inline
may cause errors.
See Instantiating rel:graphlib
for more information.
See Graphs or details on working with graphs, and Basic Operations to learn more about using the Graph Library.