Browse Source

Changed function name to prevent type piracy

pull/74/head
bosonbaas 1 month ago
parent
commit
1f0178a2ff
  1. 4
      src/visualization.jl
  2. 2
      test/petri.jl

4
src/visualization.jl

@ -83,7 +83,7 @@ add_label(g::Subgraph, pre, post) = begin
Subgraph(name, stmts, g.graph_attrs, g.node_attrs, g.edge_attrs)
end
function Subgraph(g::Graph; pre="", post="")
function tagged_subgraph(g::Graph; pre="", post="")
stmts = map(g.stmts) do st
add_label(st, pre, post)
end
@ -91,7 +91,7 @@ function Subgraph(g::Graph; pre="", post="")
end
function Subgraph(p::AbstractPetriNet; pre="", post="", kw...)
Subgraph(Graph(p; kw...); pre=pre, post=post)
tagged_subgraph(Graph(p; kw...); pre=pre, post=post)
end
######################

2
test/petri.jl

@ -51,7 +51,7 @@ graph_attrs = Attributes(:rankdir=>"LR")
node_attrs = Attributes(:shape=>"plain", :style=>"filled", :color=>"white")
edge_attrs = Attributes(:splines=>"splines")
g = Graphviz.Digraph("G", stmts1; graph_attrs=graph_attrs, node_attrs=node_attrs, edge_attrs=edge_attrs)
stmts2 = Vector{Statement}([AlgebraicPetri.Subgraph(g; post="_2")])
stmts2 = Vector{Statement}([AlgebraicPetri.tagged_subgraph(g; post="_2")])
g2 = Graphviz.Digraph("G", stmts2; graph_attrs=graph_attrs, node_attrs=node_attrs, edge_attrs=edge_attrs)
@test g2 isa Graph
@test g2.stmts[1].stmts[1].stmts[1].name == "1_s1_2"
Loading…
Cancel
Save