-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(diagram): add diagram code (#426)
Just adding the Diagram code
- Loading branch information
Showing
10 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from diagrams import Cluster, Diagram, Edge | ||
from diagrams.programming.language import Go, Nodejs, Python | ||
from diagrams.custom import Custom | ||
|
||
graph_attr = { | ||
"layout":"dot", | ||
"compound":"true", | ||
"splines":"spline", | ||
} | ||
|
||
zeros_attr = { | ||
"icon_path":"./dgraphlg.png" | ||
} | ||
|
||
ec2_attr = { | ||
"icon_path":"./dgraphlgEC2.png" | ||
} | ||
|
||
with Diagram("\ndgraph", show=False, direction="TB", graph_attr=graph_attr, outformat='png') as diag: | ||
with Cluster("RAFT Groups / Cluster (Baremetal example)"): | ||
with Cluster("0", graph_attr={"label":"Zero Group"}): | ||
a = Custom("Zero 2", **zeros_attr) | ||
b = Custom("Zero 1", **zeros_attr) | ||
c = Custom("Zero 0", **zeros_attr) | ||
|
||
with Cluster("1", graph_attr={"label":"Alpha Group"}): | ||
e = Custom("Alpha 4", **ec2_attr) | ||
f = Custom("Alpha 5", **ec2_attr) | ||
g = Custom("Alpha 6", **ec2_attr) | ||
h = Custom("Alpha 3", **ec2_attr) | ||
i = Custom("Alpha 2", **ec2_attr) | ||
j = Custom("Alpha 1", **ec2_attr) | ||
h = Custom("Alpha 0", **ec2_attr) | ||
|
||
with Cluster("2", graph_attr={"label":"APIs"}): | ||
e1 = Custom("RAW HTTP", "./http.png") | ||
f1 = Custom("gRPC", "./grpc.png") | ||
g1 = Custom("GraphQL ", "./GraphQL_Logo.png") | ||
|
||
with Cluster("3", graph_attr={"label":"Special Node(EE)"}): | ||
Learner = Custom("Learner 0", **ec2_attr) | ||
|
||
with Cluster("4", graph_attr={"label":"Clients"}): | ||
client2 = Custom("Apollo GraphQL ", "./apollo.png") | ||
client3 = Nodejs("Dgraph-JS") | ||
client4 = Python("Pydgraph") | ||
client0 = Go("Dgo") | ||
client1 = Custom("Curl", "./curl.png") | ||
|
||
b >> Edge(lhead="cluster_1") >> f | ||
|
||
g >> Edge(ltail="cluster_1") >> Learner | ||
e >> Edge(ltail="cluster_2") >> e1 | ||
|
||
g1 >> Edge(lhead="cluster_4") >> client2 | ||
f1 >> Edge(lhead="cluster_4") >> client0 | ||
e1 >> Edge(lhead="cluster_4") >> client1 | ||
|
||
diag |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
# Create a new Diagram | ||
|
||
sudo apt install graphviz | ||
|
||
pip install diagrams | ||
|
||
python3 dgraph.py |