是否有一种方法可以添加类似于特权边界的当前这里的曲线破折线?我希望在GIT中签入一个威胁模型,该模型是作为我的CI/CD构建的一部分按过程生成的,用于在线绘制它,或者在某些工具(如OmniGraffle )中,并导出图像,仅用于松散原始文档。
发布于 2022-10-08 19:40:32
您可以通过添加一些额外的边缘和不可见的节点来获得相当接近的,并为额外的边缘arrowhead=icurve使用属性,但是将不是虚线。Graphviz允许您绘制虚线簇边界,或从一个节点到另一个节点的虚线,但是如果没有手动定位、在线绘制以及我假设您需要在没有人工参与的情况下绘制,则无法绘制与一条或两条边缘垂直的线。
另外,通过使用PostScript,您还可以创建类似于A -> Internet Boundary [shape=yourshape color=red] -> B的带虚线边框的半绘制节点,但这实际上也不是一条线交叉。
图片:

以及arrowhead=icurve变体的脚本:
digraph threat_model {
graph [
splines=false
ranksep=0
nodesep=2]
User [shape=box xlabel=<<FONT COLOR="ORANGE"><B>Actor</B></FONT>>]
a [shape=circle label=<<FONT><B>a. Static<BR/>front-end<BR/>files</B></FONT>> xlabel=<<FONT COLOR="ORANGE"><B>Process</B></FONT>>]
b [shape=circle label=<<FONT><B>b. App<BR/>back-end</B></FONT>> xlabel=<<FONT COLOR="ORANGE"><B>Data<BR/>Flow</B></FONT>>]
// Two extra nodes:
boundary_User_b_1 [shape=point height=.01]
boundary_User_b_2 [shape=point height=.01]
User -> a [minlen=3 dir=both xlabel="1. Retrieve static\nfront-end files"]
// Three extra edges:
User -> boundary_User_b_1 [minlen=3 dir=back xlabel="2. Modify report"]
boundary_User_b_1 -> boundary_User_b_2 [arrowhead=icurve arrowsize=6 color=red headlabel=<<FONT COLOR="RED">Internet<BR/>Boundary</FONT>>]
boundary_User_b_2 -> b [minlen=3]
}另一个使用集群的非常接近的变体,请注意箭头可以靠在边界上,compound=true属性用于图形,lhead属性用于箭头:

digraph {
graph[
ranksep=1
compound=true
]
A
B
subgraph cluster_IB {
graph [
label="Internet Boundary"
fontcolor=red
margin=20
style="dashed, rounded"
color=red
]
C
}
A -> C
B -> C [lhead="cluster_IB"]
}https://stackoverflow.com/questions/69662766
复制相似问题