# Graphs

Methods for using/analyzing the network model as a graph

CommonOPF.make_graphFunction
make_graph(edges::AbstractVector)

return SimpleDiGraph by inferring busses from edges with the dicts for bus => int and int => bus (because Graphs.jl only works with integer nodes)

julia> g["13", :bus]
10

julia> g[13, :bus]
"24"

julia> get_prop(g, :int_bus_map)[13]
"24"
make_graph(busses::AbstractVector{String}, edges::AbstractVector)

return SimpleDiGraph with the dicts for bus => int and int => bus (because Graphs.jl only works with integer nodes)

julia> g["13", :bus]
10

julia> g[13, :bus]
"24"

julia> get_prop(g, :int_bus_map)[13]
"24"
CommonOPF.leaf_bussesFunction
leaf_busses(p::Inputs)

returns Vector{String} containing all of the leaf busses in p.busses

# Inputs

CommonOPF.remove_bus!Method
remove_bus!(j::String, p::Inputs{SinglePhase})

Remove bus j in the line i->j->k from the model by making an equivalent line from busses i->k

CommonOPF.remove_bus!Method
remove_bus!(j::String, p::Inputs{MultiPhase})

Remove bus j in the line i->j->k from the model by making an equivalent line from busses i->k

CommonOPF.reduce_tree!Method
reduce_tree!(p::Inputs{SinglePhase})

combine any line sets with intermediate busses that have indegree == outdegree == 1 and is not a load bus into a single line

See remove_bus! for how the two lines are combined.

CommonOPF.reduce_tree!Method
reduce_tree!(p::Inputs{MultiPhase})

combine any line sets with intermediate busses that satisfy 1. indegree == outdegree == 1 2. is not a load bus and 3. has same phases in as out into a single line.

See remove_bus! for how the two lines are combined.

# Utils

CommonOPF.trim_tree_once!Function
trim_tree_once!(p::Inputs)

A support function for trim_tree!. When trimming the tree sometimes new leafs are created. So trim_tree! loops over trim_tree_once!.

CommonOPF.rijMethod
rij(i::AbstractString, j::AbstractString, p::Inputs{SinglePhase})

The per-unit resistance of line i->j

CommonOPF.xijMethod
xij(i::AbstractString, j::AbstractString, p::Inputs{SinglePhase})

The per-unit reacttance of line i->j

CommonOPF.zijFunction
function zij(i::AbstractString, j::AbstractString, net::Network{SinglePhase})::Tuple{Real, Real}

Impedance for single phase models.

Returns (r1, x1) * length / net.Zbase for the Conductor at net[(i, j)].

TODO test TODO MultiPhase