2015-05-06 5 views
1

У меня есть работа по созданию V-Modell для разработки программного обеспечения. Я хочу использовать graphviz, чтобы сохранить его более удобным, чем в Visio.V-model with graphviz

Как получить типичную V-структуру в graphviz. Я думаю, что я урочу по горизонтали и вертикали. Я также пытался работать с фиктивными узлами, но макет по-прежнему оставляет желать лучшего.

+0

Я не думаю, что Graphviz - это инструмент для этого, поскольку у вас есть (!) Ограниченные возможности для управления макетом. Однако вы могли бы сделать макет самостоятельно (pos-атрибуты) и использовать nop-engine для генерации графики. – stefan

+0

Какой код вы пробовали? –

ответ

0

Этот код работает для меня. У этого есть немного обходного пути, чтобы создать V-образную форму. Я использую невидимый узел и невидимые края для создания клина между двумя сторонами V-модели.

digraph Vmodel { 
// Transparent background 
graph [bgcolor=none] 

// Node style 
node [ 
    shape=record 
    style="rounded, filled" 
    width=2.5 
    height=0.8 
    fillcolor=white 
]; 

// Create the nodes 
user_req_models  [label="User\nRequirements\nModels"] 
sys_req_models  [label="System\nRequirements\Models"] 
arch_models   [label="Architectural\Models"] 
comp_design_models [label="Component\Design\Models"] 
unit_design_models [label="Unit\nDesign\nModels"] 
units    [label="Units\n(SW, HW and Data)"] 
components   [label="Components\n(SW, HW and Data)"] 
subsystems   [label="Subsystems"] 
integrated_system [label="Integrated System"] 
operational_system [label="Operational System"] 

// Create a hidden node to form a V-shaped wedge 
hidden    [style="invis"] 

// Create the basic layout of the V model 
user_req_models->sys_req_models 
sys_req_models->arch_models 
arch_models->comp_design_models 
comp_design_models->unit_design_models 
unit_design_models->units 
units->components 
components->subsystems 
subsystems->integrated_system 
integrated_system->operational_system 

// Create the dashed edges 
user_req_models->operational_system [style="dashed", constraint=false] 
sys_req_models->integrated_system [style="dashed", constraint=false] 
arch_models->subsystems    [style="dashed", constraint=false] 
comp_design_models->components  [style="dashed", constraint=false] 

// Create a wedge between the two parts 
hidden->user_req_models   [style="invis"] 
hidden->sys_req_models   [style="invis"] 
hidden->arch_models    [style="invis"] 
hidden->comp_design_models  [style="invis"] 
hidden->operational_system  [style="invis"] 
hidden->integrated_system  [style="invis"] 
hidden->subsystems    [style="invis"] 
hidden->components    [style="invis"] 
hidden->unit_design_models  [style="invis"] 
hidden->units     [style="invis"] 

// Ranking on the same level 
{rank=same; user_req_models, operational_system} 
{rank=same; sys_req_models, integrated_system} 
{rank=same; arch_models, subsystems} 
{rank=same; comp_design_models, components} 
{rank=same; unit_design_models, units} 
} 
+0

Nice. Думаю, я могу использовать ваш код и изменить его, чтобы удовлетворить мои вещи. – MKFein

Смежные вопросы