Force Directed Edge Bundling
TODO description of FDEB
The principal function is forcebundle:
ForceBundle.forcebundle — FunctionforcebundleUse Force Directed Edge Bundling to modify a list of Edges.
Arguments
edges: array ofEdges.
Optional arguments
C = 6: number of cycles of bundling to perform.K = 0.1: global bundling constant controlling edge stiffness.S_initial = 0.1 * median(bundled_length.(edges)): initial distance to move points.S_rate = 0.5: distance rate decreases (0 < S_rate < 1).P_initial = 1: initial subdivision number.P_rate = 2: subdivision rate increase (1 < P_rate).I_initial = 60: initial number of iterations per cycle.I_rate = 2/3: rate at which iteration number decreases (0 < I_rate < 1).compatibility_threshold = 0.5: two edgesPandQonly interact whenForceBundle.compatibility(P,Q) > compatibility_threshold. Must be a number in(0,1).
Utilities
Read data
ForceBundle.read_edges_csv — Functionread_edges_csv(csv_filename; subdivisions = 1)Read a csv file and returns an array of Edges.
Arguments
csv_filename::String: path to csv file. Data must be organized in 4 columns:
|source.x, source.y, target.x, target.y| –-|–-|–-|–-
subdivisions = 1: (optional) number of inner subdivisions of eachEdge. By default,
an single subdivision is added.
Example
If a edges.csv in directory contains the following info
-1.0, 0.0, 0.0, 1.0
0.0, -1.0, 1.0, 0.0 then read_edges_csv returns a list of two Edges:
julia> edges = ForceBundle.read_edges_csv("edges.csv")
2-element Array{Edge{Float64,StructArrays.StructArray{Point{Float64},1,NamedTuple{(:x, :y),Tuple{Array{Float64,1},Array{Float64,1}}},Int64}},1}:
Edge{Float64,StructArrays.StructArray{Point{Float64},1,NamedTuple{(:x, :y),Tuple{Array{Float64,1},Array{Float64,1}}},Int64}}(Point{Float64}[[-1.0, 0.0], [-0.5, 0.5], [0.0, 1.0]])
Edge{Float64,StructArrays.StructArray{Point{Float64},1,NamedTuple{(:x, :y),Tuple{Array{Float64,1},Array{Float64,1}}},Int64}}(Point{Float64}[[0.0, -1.0], [0.5, -0.5], [1.0, 0.0]])Plotting
There is a recipe for plotting Edges. Using plot function from Plots.jl is possible by a Recipe. See RecipesBase for more details, or for using other plotting packages.