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.
- Loading branch information
Showing
5 changed files
with
44 additions
and
36 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 |
---|---|---|
@@ -1,39 +1,31 @@ | ||
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; | ||
} | ||
|
||
:walker:Creator:can:create{ | ||
end = <here>; | ||
for i = 0 to i<8 by i+=1{ | ||
if i % 2 == 0{ | ||
end ++> end := node_a(value=i+1); | ||
for i = 0 to i<7 by i+=1{ | ||
if i % 2==0{ | ||
end ++> end := node_a(value=i); | ||
} | ||
else{ | ||
end +:MyEdge:val=random.randint(1,8):+> node_a(value=i+10); | ||
end +:MyEdge:val=i:+> end := node_a(value=i+10); | ||
} | ||
} | ||
} | ||
:walker:Creator:can:travel{ | ||
#print the node values that is connected with MyEdge edges of val less than 5 | ||
for i in -:MyEdge:val<=5 :->{ | ||
for i in -:MyEdge:val<=6 :->{ | ||
print(i.value); | ||
} | ||
visit-->; | ||
} | ||
|
||
with entry{ | ||
random.seed(3); | ||
<root> spawn Creator(); | ||
#print(<root>._jac_.gen_dot()); | ||
# 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
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