Gecko.jl
Documentation for Gecko.jl, a Julia wrapper for the C++ graph ordering library Gecko.
How to use the library
using Gecko
# Graph with 4 nodes
g = GeckoGraph(4)
# Connect to quadrilateral. Insertion must be sorted by the first node index.
add_directed_edge!(g, 1, 2)
add_directed_edge!(g, 1, 3)
add_directed_edge!(g, 2, 1)
add_directed_edge!(g, 2, 4)
add_directed_edge!(g, 3, 1)
add_directed_edge!(g, 3, 4)
add_directed_edge!(g, 4, 2)
add_directed_edge!(g, 4, 3)
# Optimize ordering
order!(g)
# We can now access the optimized ordering via
new_index(g, 2 #= old_node_index =#)Citing Gecko
If you use gecko for scholarly research, please cite the following paper:
- Peter Lindstrom The Minimum Edge Product Linear Ordering Problem LLNL technical report LLNL-TR-496076, August 26, 2011.
Public API Reference
Gecko.GeckoGraph — TypeGeckoGraph([nnodes])Gecko multilevel graph for linear ordering problems.
Gecko.add_node! — Functionadd_node!(graph::GeckoGraph)Add a new node to the graph wth index num_nodes + 1.
Gecko.add_directed_edge! — Functionadd_directed_edge!(graph::GeckoGraph, i::Integer, j::Integer)Add a new directed edge to the graph, connecting nodes i and j. Insertion must be sorted by the first node index i, i.e. if we insert an edge with i=3, then we cannot add an edge with i=2 afterwards.
Gecko.cost — Functioncost(graph::GeckoGraph)Return the current cost of the ordered graph.
Gecko.num_nodes — Functionnum_nodes(graph::GeckoGraph)The current number of nodes in the graph.
Gecko.num_edges — Functionnum_nodes(graph::GeckoGraph)The current number of edges in the graph.
Gecko.order! — Functionorder!(graph::GeckoGraph [, params::GraphOrderingParameters])Reorder the graph, using the parameter set in GraphOrderingParameters.
Gecko.new_index — Functionnum_nodes(graph::GeckoGraph, i::Integer)The new index of node i after reordering.
Gecko.GraphOrderingParameters — TypeGraphOrderingParameters(;kwargs)kwargs can be one of the following:
- Optimization functional
functional = FunctionalGeometric() - Number of V cycles
iterations = 9 - Initial window size
window = 5 - Number of iterations between window increments
period = 2 - Random number seed
seed = 1
For more details on the parameters please consult the Gecko paper.
The following functionals are provided.
FunctionalQuasiconvex
FunctionalHarmonic
FunctionalGeometric
FunctionalSMR
FunctionalArithmetic
FunctionalRMS
FunctionalMaximum