-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (44 loc) · 1.41 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import logging
from argparse import ArgumentParser
import graphviz
logging.basicConfig(level=logging.INFO)
LOGGER = logging.getLogger(__name__)
def roam():
dot = graphviz.Digraph(
"roam",
comment="Roam Protocol",
node_attr={"shape": "plaintext"},
format="png",
)
dot.node("0", "Daily notes")
dot.node("A", "Daily learning")
dot.node("B", "Daily routine")
dot.node("C", "Daily writing")
dot.edges(["0A", "0B", "0C"])
dot.render(filename="roam", directory="graphs")
output_file = "graphs/roam.png"
LOGGER.info("roam graph generated at %s.", output_file)
def pkg():
dot = graphviz.Digraph(
"pkg",
comment="Personal Knowledge Graph",
node_attr={"shape": "plaintext"},
format="png",
)
dot.node("A", "Source of Knowledge (article, book, video etc)")
dot.node("B", "Processing (i.e., read and take notes)")
dot.node("C", "Understanding (write down original thoughts from notes)")
dot.edges(["AB", "BC"])
dot.render(filename="pkg", directory="graphs")
output_file = "graphs/pkg.png"
LOGGER.info("pkg graph generated at %s.", output_file)
def all():
roam()
pkg()
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("--graph", type=str, default="all")
args = parser.parse_args()
main = __import__(__name__)
func = getattr(main, args.graph)
func()