Skip to content

Commit

Permalink
Remove BuiltinGraphType, cleanup I/O
Browse files Browse the repository at this point in the history
  • Loading branch information
dcerkoney committed Sep 24, 2023
1 parent 369b56e commit 79107b3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/FeynmanDiagram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export labelreset, parity
# export AbstractOperator, Prod, Sum

export AbstractGraph, AbstractOperator
export Graph, FeynmanGraph, FeynmanProperties, BuiltinGraphType
export Graph, FeynmanGraph, FeynmanProperties

export isequiv, drop_topology, is_external, is_internal, diagram_type, orders, vertices, topology
export external_legs, external_indices, external_operators, external_labels
Expand Down
3 changes: 1 addition & 2 deletions src/computational_graph/ComputationalGraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export unary_istrivial, isassociative, isequiv
include("graph.jl")
include("feynmangraph.jl")

const BuiltinGraphType = Union{Graph,FeynmanGraph}
export Graph, FeynmanGraph, FeynmanProperties, BuiltinGraphType
export Graph, FeynmanGraph, FeynmanProperties
# export DiagramType

export isequiv, drop_topology, is_external, is_internal, diagram_type, orders, vertices, topology
Expand Down
8 changes: 1 addition & 7 deletions src/computational_graph/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ end
To add support for a user-defined graph type `G`, provide an overload method `Base.show(io::IO, graph::G; kwargs...)` with a custom text representation.
"""
function Base.show(io::IO, graph::G; kwargs...) where {G<:AbstractGraph}
if graph isa BuiltinGraphType == false
error(
"No built-in string representation for user-defined graph type $G. " *
"Please provide an overload method 'Base.show(io::IO, graph::G; kwargs...)' with a custom text representation."
)
end
if length(graph.subgraphs) == 0
typestr = ""
else
Expand Down Expand Up @@ -77,7 +71,7 @@ function plot_tree(graph::AbstractGraph; verbose=0, maxdepth=6)
if level > maxdepth
return
end
name = graph isa BuiltinGraphType ? "$(_stringrep(node, false))" : "$node"
name = "$(_stringrep(node, false))"
nt = t.add_child(name=name)

if length(node.subgraphs) > 0
Expand Down

0 comments on commit 79107b3

Please sign in to comment.