Utilities

Below is the documentation of several utility functions which are hard to put in some specific category.

Dagitty.nodeFunction
node(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
source
Dagitty.nodes_indicesFunction
nodes_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
source
Dagitty.nodes_labelsFunction
nodes_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
source
Dagitty.edges_indicesFunction
edges_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
source
Dagitty.drawdagFunction
drawdag(dag; layout=spring_layout, ...)

Draws dag with given layout method (check GraphPlot package for their description)

source
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])
source