This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from Jaseci-Labs/edges_modified
Edges modified
- Loading branch information
Showing
14 changed files
with
144 additions
and
89 deletions.
There are no files selected for viewing
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,31 @@ | ||
node node_a{ | ||
has value:int; | ||
} | ||
walker Creator { | ||
can create with `<root> entry; | ||
can travel with `<root>|node_a entry; | ||
} | ||
edge MyEdge { | ||
has val:int =5; | ||
} | ||
:walker:Creator:can:create{ | ||
end = <here>; | ||
for i = 0 to i<7 by i+=1{ | ||
if i % 2==0{ | ||
end ++> end := node_a(value=i); | ||
} | ||
else{ | ||
end +:MyEdge:val=i:+> end := node_a(value=i+10); | ||
} | ||
} | ||
} | ||
:walker:Creator:can:travel{ | ||
for i in -:MyEdge:val<=6 :->{ | ||
print(i.value); | ||
} | ||
visit-->; | ||
} | ||
with entry{ | ||
<root> spawn Creator(); | ||
# print(<r>._jac_.gen_dot()); | ||
} |
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 |
---|---|---|
@@ -1,36 +1,3 @@ | ||
import:py random; | ||
|
||
node MyNode { | ||
has value: int; | ||
|
||
} | ||
edge MyEdge { | ||
has val:int =5; | ||
} | ||
walker Walk { | ||
#has count: int = 0; | ||
can create with `<root> entry; | ||
#can do_something with `<root> entry; | ||
} | ||
|
||
:walker:Walk:can:create{ | ||
for i=0 to i<5 by i+=1 { | ||
<root> +:MyEdge:val=random.randint(1,10):+> MyNode(value=i+1); | ||
<here> ++> MyNode(value=i+1); | ||
} | ||
visit -->; | ||
} | ||
# :walker:Walk:can:do_something{ | ||
# for i in -:MyEdge:val<=5 :->{ | ||
# print(i.val); | ||
# } | ||
# } | ||
|
||
|
||
with entry { | ||
<root> spawn Walk(); | ||
#<root>._jac_.gen_dot(); | ||
|
||
} | ||
|
||
|
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 |
---|---|---|
@@ -1,22 +1 @@ | ||
""" | ||
need to create some type of edge with fields | ||
|
||
edge MyEdge { | ||
has val:int =5; | ||
} | ||
node MyNode { | ||
} | ||
create 10 edges off of root | ||
<root> +:MyEdge:val=randint(0, 10):+> MyNode() | ||
5 of these | ||
<root> ++> MyNode() | ||
then we test the refs | ||
for i in -:MyEdge:val<=5:->: | ||
print i.val; | ||
""" |
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
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
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
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
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
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
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
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,43 @@ | ||
import:py random; | ||
|
||
node node_a{ | ||
has value:int; | ||
} | ||
|
||
walker Creator { | ||
can create with `<root> entry; | ||
can travel with `<root>|node_a entry; | ||
} | ||
|
||
edge MyEdge { | ||
has val:int =5, | ||
val2:int = 10; | ||
} | ||
|
||
:walker:Creator:can:create{ | ||
end = <here>; | ||
for i = 0 to i<5 by i+=1{ | ||
end ++> end := node_a(value=i+1); | ||
if i == 2{ | ||
for j=0 to j<3 by j+=1 { | ||
end +:MyEdge:val=random.randint(1,15), val2=random.randint(1,5):+> node_a(value=j+10); | ||
} | ||
print([(i.val, i.val2) for i in list(end._jac_.edges.values())[1]]); | ||
} | ||
} | ||
for i=0 to i<3 by i+=1 { | ||
end +:MyEdge:val=random.randint(1,20):+> node_a(value=i+5); | ||
} | ||
} | ||
:walker:Creator:can:travel{ | ||
for i in -:MyEdge:val<=5:-> { | ||
print(i.value); | ||
} | ||
visit-->; | ||
} | ||
|
||
with entry{ | ||
random.seed(1); | ||
<root> spawn Creator(); | ||
#print(<root>._jac_.gen_dot()); | ||
} |
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
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ enum 'enum' emotion { | |
Angry | ||
} | ||
|
||
|
||
node 'personality' | ||
personality{ | ||
has | ||
|
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