Skip to content
Snippets Groups Projects
Commit e563dee6 authored by Sigurd Hofsmo Jakobsen's avatar Sigurd Hofsmo Jakobsen
Browse files

Made the graph undirected.

At the moment the direction of the meshed graph is never used.
I therefore removed it to make it easier to work with.
parent aeec0ed3
Branches master
No related tags found
No related merge requests found
......@@ -13,13 +13,13 @@ include("circuit_operations.jl")
export π_segment, is_zero_impedance_line, series_impedance_norm
include("graph_functions.jl")
export traverse
export traverse, subgraph
include("utility_methods.jl")
export swapcols!, swaprows!, get_id_idx
include("meta_graph_operations.jl")
export undirected_copy
# include("meta_graph_operations.jl")
# export undirected_copy
#include("plot_graphs.jl")
#export plot_to_web
......
# These two functions below are taken from a github repo
"""Make a subgraph out of all descendents with a given node as root"""
function subgraph(g::MetaDiGraph, start::Int = 0, dfs::Bool = true)::MetaDiGraph
function subgraph(g::AbstractGraph, start::Int = 0, dfs::Bool = true)::MetaDiGraph
# start = start == 0 ? root(g) : start
# removing open switch edges before traversing with BFS
g_copy = MetaGraph(g)
g_copy = copy(g)
open_switches_iter = filter_edges(g, (g,x)->(get_prop(g, x, :switch) == 0))
for e in open_switches_iter
rem_edge!(g_copy, e)
......
......@@ -14,13 +14,13 @@ mutable struct RadialPowerGraph <: PowerGraphBase
end
mutable struct PowerGraph <: PowerGraphBase
G::MetaDiGraph
G::AbstractGraph
mpc::Case
ref_bus::String
end
function RadialPowerGraph()
G = MetaDiGraph()
G = MetaGraph()
mpc = Case()
ref_bus = ""
reserves = []
......@@ -47,8 +47,8 @@ function PowerGraph(case_file::String)
PowerGraph(Case(case_file::String))
end
function read_case!(mpc::Case)
G = MetaDiGraph(mpc.branch, :f_bus, :t_bus,
function read_case!(mpc::Case, )
G = MetaGraph(mpc.branch, :f_bus, :t_bus,
edge_attributes=:rateA)
ref_bus = ""
......
......@@ -13,4 +13,4 @@ include("test_power_graph_properties.jl")
include("test_circuit_operations.jl")
include("test_metagraph.jl")
# include("test_metagraph.jl")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment