diff --git a/src/beliefpropagation/beliefpropagation_schedule.jl b/src/beliefpropagation/beliefpropagation_schedule.jl index 7cda8325..cbc5f206 100644 --- a/src/beliefpropagation/beliefpropagation_schedule.jl +++ b/src/beliefpropagation/beliefpropagation_schedule.jl @@ -1,29 +1,26 @@ default_edge_sequence_alg() = "forest_cover" -@traitfn undirected_default_bp_niters(g::AbstractGraph::(!IsDirected)) = - is_tree(g) ? 1 : nothing -function default_bp_niters(g::AbstractGraph) - return undirected_default_bp_niters(undirected_graph(underlying_graph(g))) +@traitfn default_bp_niters(g::::(!IsDirected)) = is_tree(g) ? 1 : nothing +@traitfn function default_bp_niters(g::::IsDirected) + return default_bp_niters(undirected_graph(underlying_graph(g))) end @traitfn function edge_sequence( - g::NamedGraph::(!IsDirected); alg=default_edge_sequence_alg(), kwargs... + g::::(!IsDirected); alg=default_edge_sequence_alg(), kwargs... ) return edge_sequence(Algorithm(alg), g; kwargs...) end -function edge_sequence(g::AbstractGraph; alg=default_edge_sequence_alg(), kwargs...) +@traitfn function edge_sequence(g::::IsDirected; alg=default_edge_sequence_alg(), kwargs...) return edge_sequence(Algorithm(alg), undirected_graph(underlying_graph(g)); kwargs...) end -function edge_sequence(alg::Algorithm, g::AbstractGraph; kwargs...) +@traitfn function edge_sequence(alg::Algorithm, g::::IsDirected; kwargs...) return edge_sequence(alg, undirected_graph(underlying_graph(g)); kwargs...) end @traitfn function edge_sequence( - ::Algorithm"forest_cover", - g::NamedGraph::(!IsDirected); - root_vertex=NamedGraphs.default_root_vertex, + ::Algorithm"forest_cover", g::::(!IsDirected); root_vertex=NamedGraphs.default_root_vertex ) forests = NamedGraphs.forest_cover(g) edges = edgetype(g)[] @@ -38,6 +35,6 @@ end return edges end -@traitfn function edge_sequence(::Algorithm"parallel", g::NamedGraph::(!IsDirected)) +@traitfn function edge_sequence(::Algorithm"parallel", g::::(!IsDirected)) return [[e] for e in vcat(edges(g), reverse.(edges(g)))] end