API Reference
JGraphs.JGraph
— MethodJGraph(g::JGraphData)
The JGraph
structure is the core structure of the package when called with a JGraphData
argument creates and Object
for each node in the graph and stores them in jnodes
and an Object
for each edge and stores them in jedges
. Note that jnodes
is a Vector
, whereas jedges
is a Dict
with pairs of nodes (integers) as keys.
Since JGraph
stores Object
s it can only be called after a Video
has been initialized look at Javis
documentation to know all about it.
JGraphs.JGraphData
— TypeJGraphData(graph::AbstractGraph, layout::NetworkLayout.AbstractLayout; kwargs...)
The JGraphData
is the structure used to set all the properties of the graph animation, the graph itself, its layout and all the options useful to animate it in the appropriate way. It should be passed to JGraph
to obtain an animation with the specified properties. The keyword arguments will increase to increase in the future.
Arguments
graph::AbstractGraph
: A graph as created withLightGraphs
and affiliate packageslayout::NetworkLayout.AbstractLayout
: A layout as provided byNetworkLayout
to place the graph nodes in space.
Keywords
node_template
provide function that could be used as the function argument of anObject
edges_color
sets the colors of all edgesedges_size
sets the width of all edgeswidth
sets the width to which the graph will be adjustedheight
sets the height to which the graph will be adjustedframes
the frames during which the animations on the graph will last if not specified elsewherenumbered
Defaults tofalse
if set totrue
labels the nodes with their number as vertices in the graph.
JGraphs.GB2Luxor
— MethodGB2Luxor(p)
Transforms a Point
defined in GeometryBasics
into one defined in Luxor
.
JGraphs._adapt_to_lims
— Method_adapt_to_lims(points, width, height)
Rescales a vector of points to fit in height and width to keep it simple it uses the smallest among x and y needed variation to rescale both.
JGraphs.draw_node
— Methoddraw_node(args; center, radius, action)
Function used to draw a circle. Very similar to Javis.JCircle
with the only difference that it does not use sethue
so animating a color change is easier.
JGraphs.get_starting_positions
— Methodget_starting_positions(g::JGraph)
Returns the positions as obtained using the layout and the graph stored in g.data
.
JGraphs.jedges
— Methodjedges(jg::JGraph)
Accessor function to the jedges
stored in a JGraph
.
JGraphs.jgraph_morph
— Methodjgraph_morph(g::JGraph, layout_to, lims_to; frames=nothing)
This functions allows to animate the change from one layout to another for a graph.
Arguments
g::JGraph
theJGraph
to animate.layout_to
aNetworkLayout.AbstractLayout
or aVector{NetworkLayout.AbstractLayout}
that will be applied to nodes and edges
to determine the configuration to reach.
lims_to
a tuple or a vector of tuples each holding width and height to scale the positions of nodes and edges in the animation.
Keywords
frames
a range of frames during which the morph will take place.
If not specified the animation will last as long aas the JGraph itself.
starting_positions
specifies the starting positions of each node, defaults
JGraphs.jgraph_walk
— Methodjgraph_walk(g::JGraph, walk_func)
This function will iteratively change the colors of nodes and edges in a graph to draw a path along them of the graph.
Arguments
g::JGraph
theJGraph
on which the walk should be animatedwalk_func
a function that takes as argument andAbstractGraph
and returns
a set of nodes linked each to the following one by and edge present in the graph. One can use randomwalk
and non_backtracking_randomwalk
from LightGraphs
.
JGraphs.jnodes
— Methodjnodes(jg::JGraph)
Accessor function to the jnodes
stored in a JGraph
.