Pull to refresh

Comments 8

Конкретно в этом случае UML deployment diagram более уместна

Кроме упомЯнутых вариантов использования языка dot, хочу сказать ещё об одном: автоматическое построение автоматических тестов аппаратуры. Если имеется некий прибор с набором интерфейсов (CAN, RS-422, Ethernet и т.д.) то мы можем описать его графом, где каждый узел это конкретный экземпляр интерфейса, в атрибутах узла указываем его тип и свойства. Имя узла содержит позиционное обозначение разъема на который он выведен и номера используемых контактов. Создав таким образом файлы описания для других устройств входящих в комплекс аналогично пишем описания кабелей, жгутов соединяющих их в единую систему. В отличие от приборов, граф кабеля будет содержать множество ребер, соединяющих контакты его соединителей. Далее создаем файл в который инклюдим файлы приборов , кабелей и выполняем их соединение, таким образом у нас получился файл топологии комплекса, где для каждой электрической (или не электрической ) связи есть описание интерфейса который её использует. Далее натравливаем на этот файл парсер, который находит в описанной топологии изолированные субграфы. И по известному типу интерфейса подбирает автоматический тест который выполняет передачу тестовых данных между узлами субграфа, параллельно парсер отрисовывает на экране управляющего компьютера визуальный интерфейс где каждому найденному субграфу ставится в соответствие индикатор, показывающий результат его проверки.

a) Ручное рисование весьма утомительно. Обязательно наступят боли в запястье.
b) Использование мышки в программировании вообще считается дурным тоном.
c) Трудно подвергнуть *.svg файл версионному контролю. Конфликты при git merge *.svg так как это в сущности *.xml(ка).

так инкскейп дружит с питоном

Но графвизом рисовать всё равно проще и быстрее — я проверял. Ну и помимо dot в его состав входят и другие утилиты для рисования графов.

Какие именно утилиты?

dot — для ориентированных графов и всяких иерархий, neato — для неориентированных, circo и twopi — для разложенных по окружностям плюc ещё несколько.
https://graphviz.org/docs/layouts/ — тут подробнее.

man dot вам в помощь :-)

DOT(1)                                  General Commands Manual                                 DOT(1)

NAME
       dot - filter for drawing directed graphs
       neato - filter for drawing undirected graphs
       twopi - filter for radial layouts of graphs
       circo - filter for circular layout of graphs
       fdp - filter for drawing undirected graphs
       sfdp - filter for drawing large undirected graphs
       patchwork - filter for squarified tree maps
       osage - filter for array-based layouts

SYNOPSIS
       dot [options] [files]
       neato [options] [files]
       twopi [options] [files]
       circo [options] [files]
       fdp [options] [files]
       sfdp [options] [files]
       patchwork [options] [files]
       osage [options] [files]

DESCRIPTION
       These  are  a  collection of programs for drawing graphs.  There is actually only one main pro‐
       gram; the specific layout algorithms are implemented as plugins. Thus, they largely  share  all
       of the same command-line options.

       dot  draws directed graphs.  It works well on directed acyclic graphs and other graphs that can
       be drawn as hierarchies or have a natural ``flow.''

       neato draws undirected graphs using a ``spring'' model and reducing the related energy (see Ka‐
       mada and Kawai, Information Processing Letters 31:1, April 1989).

       twopi  draws graphs using a radial layout (see G. Wills, Symposium on Graph Drawing GD'97, Sep‐
       tember, 1997).  Basically, one node is chosen as the center and put at the origin.  The remain‐
       ing  nodes  are  placed  on  a sequence of concentric circles centered about the origin, each a
       fixed radial distance from the previous circle.  All nodes  distance  1  from  the  center  are
       placed  on the first circle; all nodes distance 1 from a node on the first circle are placed on
       the second circle; and so forth.

       circo draws graphs using a circular layout (see Six and Tollis, GD  '99  and  ALENEX  '99,  and
       Kaufmann and Wiese, GD '02.)  The tool identifies biconnected components and draws the nodes of
       the component on a circle. The block‐cutpoint tree is then laid out using  a  recursive  radial
       algorithm.  Edge  crossings  within a circle are minimized by placing as many edges on the cir‐
       cle's perimeter as possible.  In particular, if the component  is  outerplanar,  the  component
       will  have  a planar layout.  If a node belongs to multiple non‐trivial biconnected components,
       the layout puts the node in one of them. By default, this is the  first  non‐trivial  component
       found in the search from the root component.

       fdp draws undirected graphs using a ``spring'' model. It relies on a force‐directed approach in
       the spirit of Fruchterman and Reingold (cf. Software‐Practice & Experience  21(11),  1991,  pp.
       1129‐1164).

       sfdp  also  draws  undirected  graphs using the ``spring'' model described above, but it uses a
       multi-scale approach to produce layouts of large graphs in a reasonably short time.

       patchwork draws the  graph  as  a  squarified  treemap  (see  M.  Bruls  et  al.,  ``Squarified
       treemaps'',  Proc.  Joint  Eurographics and IEEE TCVG Symp. on Visualization, 2000, pp. 33-42).
       The clusters of the graph are used to specify the tree.

       osage draws the graph using its cluster structure. For a given cluster, each of its subclusters
       is laid out internally.  Then the subclusters, plus any remaining nodes, are repositioned based
       on the cluster's pack and packmode attributes.

Я бы обратил ваше внимание на утилилиту gvpr (потоковый редактор графов), которая для графов является аналогом утилиты awk. Сам я её не применял, но например её можно было бы использовать для получения из общего графа его вариантов(версий, исполнений).

Sign up to leave a comment.

Articles