Пакет mnas-graph определяет базовые функции для создания структуры данных типа Graph и ее отображения через graphviz.
Пакет определяет следующие основные классы:
Пример использования:
(let*
((g (make-instance 'mnas-graph:<graph>))
(v1 (make-instance 'mnas-graph:<node> :owner g :name "v1"))
(v2 (make-instance 'mnas-graph:<node> :owner g :name "v2"))
(v3 (make-instance 'mnas-graph:<node> :owner g :name "v3"))
(r1 (make-instance 'mnas-graph:<edge> :tail v1 :head v2))
(r2 (make-instance 'mnas-graph:<edge> :tail v2 :head v3))
(r3 (make-instance 'mnas-graph:<edge> :tail v3 :head v1)))
(mnas-graph:insert-to v1 g)
(mnas-graph:insert-to v2 g)
(mnas-graph:insert-to v3 g)
(mnas-graph:insert-to r1 g)
(mnas-graph:insert-to r2 g)
(mnas-graph:insert-to r3 g)
(mnas-graph:view-graph g))
Функции
make-graph
(edges &key nodes)
Описание: функция make-graph возвращает граф с ребрами
edges и вершинами вершинами nodes.
Пример использования:
(mnas-graph/view:view-graph
(make-graph '(("a" "c")("b" "c")("c" "d")
("c" "g")("c" "e")("e" "f")
("e" "g")("h" "j")("b" "f"))
:nodes
'("k")))
make-random-graph
(&key (node-max-number 100) (edges-number node-max-number))
Описание: функция make-random-graph возвращает случайный граф
с количеством ребер равным edges-number и количеством вершин не
превышающим node-max-number.Пример использования:
(mnas-graph/view:view-graph
(make-random-graph :node-max-number 20 :edges-number 10))
Обобщенные функции
connected-nodes
(node graph &key direction)
Описание: обобщенная функция connected-nodes возвращает
хеш-таблицу доситжимых вершин при поиске в глубину начиная с вершины
node.
Параметр direction задает направление поиска:
- :direction-to - поиск ведется в направлении ребер входящих в вершину;
- :direction-ftom - поиск ведется в направлении ребер исходящих из вершины.
edge-names
(graph)
Описание: обобщенная функция edge-names возвращает список
имен ребер графа graph.
find-backward-nodes
(node graph)
Описание: обобщенная функция find-backward-nodes возвращает
хеш-таблицу ближайших вершин, с которыми соединена вершина node,
в направлении против течения.
find-both-nodes
(node graph)
Описание: обобщенная функция find-backward-nodes возвращает
хеш-таблицу ближайших вершин, с которыми соединена вершина node,
в направлениях по и против течения.
find-forward-nodes
(node graph)
Описание: обобщенная функция find-forward-nodes возвращает
хеш-таблицу ближайших вершин, с которыми соединена вершина node, в
направлении течения.
inlet-edges
(node graph)
Описание: обобщенная функция inlet-edges возвращает
хеш-таблицу исходящих ребер (истоков) для вершины node
inlet-nodes
(graph)
Описание: обобщенная функция inlet-nodes возвращает
хеш-таблицу вершин-стоков для графа graph.
Пример использования:
(let ((g (make-random-graph :node-max-number 16)))
(mnas-graph/view:view-graph g)
(inlet-nodes g))
isolated-nodes
(graph)
Описание: обобщенная функция inlet-nodes возвращает
хеш-таблицу изолированных вершин для графа graph.
Пример использования:
(let ((g (make-random-graph :node-max-number 16)))
(mnas-graph/view:view-graph g)
(inlet-nodes g))
outlet-nodes
(graph)
Описание: обобщенная функция outlet-nodes возвращает
хеш-таблицу вершин-истоков для графа graph.
Методы
connected-nodes
((n <node>) (graph <graph>) &key (direction both) &aux (ht (make-hash-table)))
Описание: обобщенная функция connected-nodes возвращает
хеш-таблицу доситжимых вершин при поиске в глубину начиная с вершины
node.
Параметр direction задает направление поиска:
- :direction-to - поиск ведется в направлении ребер входящих в вершину;
- :direction-ftom - поиск ведется в направлении ребер исходящих из вершины.
count-edges
((graph <graph>))
Описание: метод count-edges возвращает количество ребер
графа graph.
Пример использования:
;
(count-edges (make-random-graph)) -> 100
count-nodes
((graph <graph>))
Описание: метод count-nodes возвращает количество вершин
графа graph.
Пример использования:
;
(count-nodes (make-random-graph)) -> some wat less then 100
find-backward-nodes
((node <node>) (graph <graph>) &aux (ht (make-hash-table)))
Описание: метод find-backward-nodes возвращает хеш-таблицу
вершин, с которыми соединена вершина node, в направлении от них к
ней.
find-both-nodes
((node <node>) (graph <graph>) &aux (ht (make-hash-table)))
Описание: метод find-both-nodes возвращает хеш-таблицу вершин, с
которыми соединена вершина <node>, в направлении от нее к ним.
find-forward-nodes
((node <node>) (graph <graph>) &aux (ht (make-hash-table)))
Описание: метод find-forward-nodes возвращает хеш-таблицу вершин, с
которыми соединена вершина <node>, в направлении от нее к ним.
Классы
<clusterrank>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: clusterrank
sl-clusterrank
Type: clusterModeOption Value Allocation: instance Type: nil
Initarg: :clusterrank
Initform: nil
Accessors: (attr-clusterrank)
<colorscheme>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: colorscheme
sl-colorscheme
Type: stringOption Value Allocation: instance Type: nil
Initarg: :colorscheme
Initform: nil
Accessors: (attr-colorscheme)
<concentrate>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: concentrate
sl-concentrate
Type: boolOption Value Allocation: instance Type: nil
Initarg: :concentrate
Initform: nil
Accessors: (attr-concentrate)
<defaultdist>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: defaultdist
sl-defaultdist
Type: doubleOption Value Allocation: instance Type: nil
Initarg: :defaultdist
Initform: nil
Accessors: (attr-defaultdist)
<diredgeconstraints>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: diredgeconstraints
sl-diredgeconstraints
Option Value Allocation: instance Type: nil
Initarg: :diredgeconstraints
Initform: nil
Accessors: (attr-diredgeconstraints)
<edge>
Option | Value |
Superclasses: | (<edge-attributes> t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Описание: класс <edge> представляет ребро графа.
tail
Начальная вершина ребраOption Value Allocation: instance Type: nil
Initarg: :tail
Initform: nil
Accessors: (tail)
head
Конечная вершина ребраOption Value Allocation: instance Type: nil
Initarg: :head
Initform: nil
Accessors: (head)
<edgetooltip>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: edgetooltip
sl-edgetooltip
Type: escStringOption Value Allocation: instance Type: nil
Initarg: :edgetooltip
Initform: nil
Accessors: (attr-edgetooltip)
<forcelabels>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: forcelabels
sl-forcelabels
Type: boolOption Value Allocation: instance Type: nil
Initarg: :forcelabels
Initform: nil
Accessors: (attr-forcelabels)
<gradientangle>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: gradientangle
sl-gradientangle
Type: intOption Value Allocation: instance Type: nil
Initarg: :gradientangle
Initform: nil
Accessors: (attr-gradientangle)
<graph>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Описание: класс <graph> представляет граф.
nodes
Хешированная таблица вершин графаOption Value Allocation: instance Type: nil
Initform: (make-hash-table)
Accessors: (nodes)
edges
Хешированная таблица ребер графаOption Value Allocation: instance Type: nil
Initform: (make-hash-table)
Accessors: (edges)
rankdir
Определяет направление отрисовки: TB, LR, BT, RL.Option Value Allocation: instance Type: nil
Initform: "TB"
Accessors: (rankdir)
<headtooltip>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: headtooltip
sl-headtooltip
Type: escStringOption Value Allocation: instance Type: nil
Initarg: :headtooltip
Initform: nil
Accessors: (attr-headtooltip)
<label_scheme>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: label_scheme
sl-label_scheme
Type: intOption Value Allocation: instance Type: nil
Initarg: :label_scheme
Initform: nil
Accessors: (attr-label_scheme)
<labeldistance>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: labeldistance
sl-labeldistance
Type: doubleOption Value Allocation: instance Type: nil
Initarg: :labeldistance
Initform: nil
Accessors: (attr-labeldistance)
<labelfontcolor>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: labelfontcolor
sl-labelfontcolor
Type: colorOption Value Allocation: instance Type: nil
Initarg: :labelfontcolor
Initform: nil
Accessors: (attr-labelfontcolor)
<labelfontname>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: labelfontname
sl-labelfontname
Type: stringOption Value Allocation: instance Type: nil
Initarg: :labelfontname
Initform: nil
Accessors: (attr-labelfontname)
<labelfontsize>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: labelfontsize
sl-labelfontsize
Type: doubleOption Value Allocation: instance Type: nil
Initarg: :labelfontsize
Initform: nil
Accessors: (attr-labelfontsize)
<labeltarget>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: labeltarget
sl-labeltarget
Type: escStringOption Value Allocation: instance Type: nil
Initarg: :labeltarget
Initform: nil
Accessors: (attr-labeltarget)
<labeltooltip>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: labeltooltip
sl-labeltooltip
Type: escStringOption Value Allocation: instance Type: nil
Initarg: :labeltooltip
Initform: nil
Accessors: (attr-labeltooltip)
<layerlistsep>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: layerlistsep
sl-layerlistsep
Type: stringOption Value Allocation: instance Type: nil
Initarg: :layerlistsep
Initform: nil
Accessors: (attr-layerlistsep)
<layerselect>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: layerselect
sl-layerselect
Type: layerRangeOption Value Allocation: instance Type: nil
Initarg: :layerselect
Initform: nil
Accessors: (attr-layerselect)
<notranslate>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: notranslate
sl-notranslate
Type: boolOption Value Allocation: instance Type: nil
Initarg: :notranslate
Initform: nil
Accessors: (attr-notranslate)
<orientation>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: orientation
sl-orientation
Option Value Allocation: instance Type: nil
Initarg: :orientation
Initform: nil
Accessors: (attr-orientation)
<outputorder>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: outputorder
sl-outputorder
Type: outputModeOption Value Allocation: instance Type: nil
Initarg: :outputorder
Initform: nil
Accessors: (attr-outputorder)
<overlap_scaling>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: overlap_scaling
sl-overlap_scaling
Type: doubleOption Value Allocation: instance Type: nil
Initarg: :overlap_scaling
Initform: nil
Accessors: (attr-overlap_scaling)
<overlap_shrink>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: overlap_shrink
sl-overlap_shrink
Type: boolOption Value Allocation: instance Type: nil
Initarg: :overlap_shrink
Initform: nil
Accessors: (attr-overlap_shrink)
<peripheries>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: peripheries
sl-peripheries
Type: intOption Value Allocation: instance Type: nil
Initarg: :peripheries
Initform: nil
Accessors: (attr-peripheries)
<repulsiveforce>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: repulsiveforce
sl-repulsiveforce
Type: doubleOption Value Allocation: instance Type: nil
Initarg: :repulsiveforce
Initform: nil
Accessors: (attr-repulsiveforce)
<samplepoints>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: samplepoints
sl-samplepoints
Type: intOption Value Allocation: instance Type: nil
Initarg: :samplepoints
Initform: nil
Accessors: (attr-samplepoints)
<tailtooltip>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: tailtooltip
sl-tailtooltip
Type: escStringOption Value Allocation: instance Type: nil
Initarg: :tailtooltip
Initform: nil
Accessors: (attr-tailtooltip)
<voro_margin>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: voro_margin
sl-voro_margin
Type: doubleOption Value Allocation: instance Type: nil
Initarg: :voro_margin
Initform: nil
Accessors: (attr-voro_margin)
<xdotversion>
Option | Value |
Superclasses: | (t) |
Metaclass: | standard-class |
Default Initargs: | nil |
Attribute: xdotversion
sl-xdotversion
Type: stringOption Value Allocation: instance Type: nil
Initarg: :xdotversion
Initform: nil
Accessors: (attr-xdotversion)