Skip to content

Commit bc5e8dd

Browse files
author
Jegors Čemisovs
committed
add graph2puml.awk
Signed-off-by: Jegors Čemisovs <jegors_cemisovs@epam.com>
1 parent c9752c0 commit bc5e8dd

File tree

7 files changed

+107
-2
lines changed

7 files changed

+107
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ flowchart LR
9090
C --> |1| A
9191
C --> |3| B
9292
```
93-
94-
![Small Graph](docs/assets/small.gif)
93+
![Small Graph PlantUML](http://www.plantuml.com/plantuml/svg/bT2n3e8m483XcJv5mmo36EDWQWGMTqV2SD03cXmjQQk9CRwx4CN0fhVTbpyttCbvi5uQpwHgBGmTl_H0n1yiQ8ps6deKuHdfXbxL4ALM0KKEj8iTMjM4BD168Yz-YaiMe6p_gD-tQqF62b9jvokwOX9nv--4eb54ACUjWm55hMnDM1vOaFBuo3DU45H8Ol-bVAPaecoYTARjI7oSR1NkFfglsirIi-M59pkXbkCtNm00)
9594

9695

9796
### Medium Graph Sample
@@ -129,3 +128,4 @@ flowchart LR
129128

130129
![Complex Graph](docs/assets/complex.gif)
131130

131+
![Complex Graph PlantUML](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/rabestro/graph-pathfinding-algorithms/master/graph-shell/docs/complex.puml)

docs/simple.puml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@startdot
2+
digraph Small {
3+
fontname="Helvetica,Arial,sans-serif"
4+
node [fontname="Helvetica,Arial,sans-serif"]
5+
edge [fontname="Helvetica,Arial,sans-serif"]
6+
node [color=lightblue2, style=filled, shape=circle];
7+
A
8+
A -> B [label=7];
9+
A -> C [label=2];
10+
B -> A [label=3];
11+
B -> C [label=5];
12+
C -> A [label=1];
13+
C -> B [label=3];
14+
}
15+
@enddot

graph-shell/docs/complex.png

35.4 KB
Loading

graph-shell/docs/complex.puml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@startdot
2+
digraph complex {
3+
fontname="Helvetica,Arial,sans-serif"
4+
node [fontname="Helvetica,Arial,sans-serif"]
5+
edge [fontname="Helvetica,Arial,sans-serif"]
6+
node [color=lightblue2, style=filled, shape=circle];
7+
A
8+
A -> B [label=5];
9+
A -> H [label=2];
10+
B
11+
B -> A [label=5];
12+
B -> C [label=7];
13+
C
14+
C -> B [label=7];
15+
C -> D [label=3];
16+
C -> G [label=4];
17+
D
18+
D -> C [label=20];
19+
D -> E [label=4];
20+
E
21+
E -> F [label=5];
22+
F
23+
F -> G [label=6];
24+
G
25+
G -> C [label=4];
26+
H
27+
H -> G [label=3];
28+
}
29+
@enddot

graph-shell/docs/medium.puml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@startdot
2+
digraph medium {
3+
fontname="Helvetica,Arial,sans-serif"
4+
node [fontname="Helvetica,Arial,sans-serif"]
5+
edge [fontname="Helvetica,Arial,sans-serif"]
6+
node [color=lightblue2, style=filled, shape=circle];
7+
A
8+
A -> B [label=5];
9+
B
10+
B -> A [label=5];
11+
B -> C [label=10];
12+
C
13+
C -> B [label=20];
14+
C -> D [label=5];
15+
D
16+
D -> E [label=5];
17+
E
18+
E -> B [label=5];
19+
}
20+
@enddot

graph-shell/docs/simple.puml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@startdot
2+
digraph simple {
3+
fontname="Helvetica,Arial,sans-serif"
4+
node [fontname="Helvetica,Arial,sans-serif"]
5+
edge [fontname="Helvetica,Arial,sans-serif"]
6+
node [color=lightblue2, style=filled, shape=circle];
7+
A
8+
A -> B [label=7];
9+
A -> C [label=2];
10+
B
11+
B -> A [label=3];
12+
B -> C [label=5];
13+
C
14+
C -> A [label=1];
15+
C -> B [label=3];
16+
}
17+
@enddot
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
BEGIN {
2+
FS = "[ :,{}]+"
3+
}
4+
BEGINFILE {
5+
match(FILENAME, /([^/]+)\.yaml/, GraphName)
6+
print "@startdot"
7+
print "digraph", GraphName[1], "{"
8+
print "fontname=\"Helvetica,Arial,sans-serif\""
9+
print "node [fontname=\"Helvetica,Arial,sans-serif\"]"
10+
print "edge [fontname=\"Helvetica,Arial,sans-serif\"]"
11+
print "node [color=lightblue2, style=filled, shape=circle];"
12+
}
13+
{
14+
print $1
15+
}
16+
{
17+
for (i = 2; i < NF; i += 2) {
18+
print $1, "->", $i, "[label=" $(i + 1) "];"
19+
}
20+
}
21+
ENDFILE {
22+
print "}"
23+
print "@enddot"
24+
}

0 commit comments

Comments
 (0)