yagraphlib 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/yagraphlib.rb +24 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f269b571dee46970840824748408106885241f31
|
|
4
|
+
data.tar.gz: 01662bb5ca1b2649a11394506959ed0b130aeadb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 64e9a2ed3db04db8707e4d31f8afb01533b1118e1eaba30fc0b44e07183d91a70a3e58041e4bf8a88e12e659579f01ca93e67ed0e14704f8cb22ed088bcdda0b
|
|
7
|
+
data.tar.gz: 747d0856ed4152d502a3b0c085d91415eb179ba3b1ea12d8cd34067697bab405f5a7c2eba993d3cc475f7f9164c485e09556410e2a924df75968dda91f5f8f1a
|
data/lib/yagraphlib.rb
CHANGED
|
@@ -43,6 +43,7 @@ module YaGraph
|
|
|
43
43
|
def initialize()
|
|
44
44
|
@nodes = {}
|
|
45
45
|
@edges = {}
|
|
46
|
+
@subgraphs = {}
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
def edges(edge)
|
|
@@ -59,6 +60,10 @@ module YaGraph
|
|
|
59
60
|
@nodes[node.uid] ||= node
|
|
60
61
|
end
|
|
61
62
|
|
|
63
|
+
def subgraph(subgraph)
|
|
64
|
+
@subgraphs[subgraph.uid] ||= subgraph
|
|
65
|
+
end
|
|
66
|
+
|
|
62
67
|
def rankdir(mode)
|
|
63
68
|
@rankdir = mode
|
|
64
69
|
end
|
|
@@ -84,12 +89,31 @@ module YaGraph
|
|
|
84
89
|
def to_graphviz(out)
|
|
85
90
|
out.puts("digraph main {\n")
|
|
86
91
|
out.puts(" rankdir=#{@rankdir}") if @rankdir
|
|
92
|
+
@subgraphs.each {|k, s| s.to_graphviz(out) }
|
|
87
93
|
@nodes.each {|k, n| n.to_graphviz(out) }
|
|
88
94
|
@edges.each {|k, e| e.to_graphviz(out) }
|
|
89
95
|
out.puts("}")
|
|
90
96
|
end
|
|
91
97
|
end
|
|
92
98
|
|
|
99
|
+
class SubGraph < Graph
|
|
100
|
+
def initialize()
|
|
101
|
+
super()
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def is_cluster() false end
|
|
105
|
+
|
|
106
|
+
def to_graphviz(out)
|
|
107
|
+
out.puts(" subgraph #{if is_cluster() then "cluster_" else "" end}#{uid()} {")
|
|
108
|
+
if label() then out.puts(" label=\"#{label()}\"") end
|
|
109
|
+
@nodes.each {|k, n| out.write(" "); n.to_graphviz(out) }
|
|
110
|
+
@edges.each {|k, e| out.write(" "); e.to_graphviz(out) }
|
|
111
|
+
out.puts(" }")
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def label() nil end
|
|
115
|
+
end
|
|
116
|
+
|
|
93
117
|
class Node < Element
|
|
94
118
|
def id() "" end
|
|
95
119
|
def to_graphviz(out)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yagraphlib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- candle
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-05-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|