Import datalog
This commit is contained in:
parent
b49582a5dc
commit
091e518a7e
18 changed files with 2510 additions and 0 deletions
projects/datalog
25
projects/datalog/make_graph.py
Normal file
25
projects/datalog/make_graph.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"""
|
||||
For benchmarking the datalog.
|
||||
|
||||
Generates a large graph, which will be expensive to enumerate 2-edges over and paths through.
|
||||
"""
|
||||
|
||||
from random import choice
|
||||
from uuid import uuid4 as uuid
|
||||
|
||||
|
||||
with open("graph.dtl", "w") as f:
|
||||
nodes = []
|
||||
|
||||
# Generate 10k edges
|
||||
for i in range(10000):
|
||||
if nodes:
|
||||
from_node = choice(nodes)
|
||||
else:
|
||||
from_node = uuid()
|
||||
|
||||
to_node = uuid()
|
||||
|
||||
nodes.append(to_node)
|
||||
|
||||
f.write(f"edge({str(from_node)!r}, {str(to_node)!r}).\n")
|
||||
Loading…
Add table
Add a link
Reference in a new issue