Utilities
Below is the documentation of several utility functions which are hard to put in some specific category.
Dagitty.node
— Functionnode(dag, label)
Resolve node label in DAG: by node label return underlying graph node index
Examples
julia> using Dagitty
julia> g = DAG(:A => :C, :C => :B)
DAG: {3, 2} directed simple Int64 graph with labels [:A, :B, :C])
julia> node(g, :C)
3
Dagitty.nodes_indices
— Functionnodes_indices(dag, labels)
Convert vector of node labels to vector of underlying graph node indices
Examples
julia> using Dagitty
julia> g = DAG(:A => :C, :C => :B)
DAG: {3, 2} directed simple Int64 graph with labels [:A, :B, :C])
julia> nodes_indices(g, [:A, :C])
2-element Vector{Int64}:
1
3
Dagitty.nodes_labels
— Functionnodes_labels(dag, indices)
From vector of indices return vector of node labels.
Examples
julia> using Dagitty
julia> g = DAG(:A => :C, :C => :B)
DAG: {3, 2} directed simple Int64 graph with labels [:A, :B, :C])
julia> nodes_labels(g, [1, 3])
2-element Vector{Symbol}:
:A
:C
Dagitty.edges_indices
— Functionedges_indicse(dag, edges)
Convert list of edges (pairs of symbols) into list of node indices' pairs.
Examples
julia> using Dagitty
julia> g = DAG(:A => :B)
DAG: {2, 1} directed simple Int64 graph with labels [:A, :B])
julia> edges_indices(g, [:A => :B, :B => :A])
2-element Vector{Pair{Int64, Int64}}:
1 => 2
2 => 1
Dagitty.drawdag
— Functiondrawdag(dag; layout=spring_layout, ...)
Draws dag with given layout method (check GraphPlot package for their description)
drawdag(dag, locs_x, locs_y)
Draws dag with given locations of every node
Examples
julia> g = DAG(:A => :C, :C => :B)
DAG: {3, 2} directed simple Int64 graph with labels [:A, :B, :C])
julia> drawdag(g, [0, 0, 1], [0, 1, 1])