forked from souffle-lang/souffle
-
Notifications
You must be signed in to change notification settings - Fork 2
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 souffle-lang#245 from mmcgr/master
Add 5 new tests of aggregate functions.
- Loading branch information
Showing
28 changed files
with
152 additions
and
0 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
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,4 @@ | ||
b 1 | ||
e 3 | ||
c 1 | ||
d 1 |
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,3 @@ | ||
a 2 | ||
b 2 | ||
c 2 |
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,12 @@ | ||
// Find the shorted outward edge for every Node | ||
.type Node | ||
|
||
.decl Edge(n:Node, m:Node, w:number) input | ||
|
||
.decl OutDegree(n:Node, l:number) output | ||
|
||
OutDegree(x, l) :- Edge(x, _, _), l = sum 1 : Edge(x, _, _). | ||
|
||
.decl InDegree(n:Node, l:number) output | ||
|
||
InDegree(x, l) :- Edge(_, x, _), l = sum 1 : Edge(_, x, _). |
Empty file.
Empty file.
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,6 @@ | ||
a b 1 | ||
a e 5 | ||
b c 2 | ||
b e 4 | ||
c d 3 | ||
c e 40 |
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,27 @@ | ||
a g | ||
a h | ||
a f | ||
b g | ||
b h | ||
b f | ||
c b | ||
c g | ||
c h | ||
c f | ||
f b | ||
f e | ||
f c | ||
f d | ||
g b | ||
g e | ||
g c | ||
g d | ||
h b | ||
h e | ||
h c | ||
h d | ||
b a | ||
c a | ||
f a | ||
g a | ||
h a |
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,16 @@ | ||
// Find all disconnected node pairs | ||
.type Node | ||
|
||
.decl Edge(n:Node, m:Node, w:number) input | ||
|
||
// Find the connected nodes | ||
.decl Connected(n:Node, m:Node) | ||
Connected(n, n) :- Edge(n, _, _). | ||
Connected(n, n) :- Edge(_, n, _). | ||
Connected(n, m) :- Edge(n, m, _). | ||
Connected(n, m) :- Edge(n, z, _), Connected(z, m). | ||
|
||
// Find nodes without a connection | ||
.decl DisConnected(n:Node, m:Node) output | ||
DisConnected(n, m) :- Edge(n, _, _), Edge(_, m, _), !Connected(n, m). | ||
DisConnected(n, m) :- Edge(n, _, _), Edge(m, _, _), !Connected(n, m). |
Empty file.
Empty file.
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,9 @@ | ||
a b 1 | ||
a e 5 | ||
b c 2 | ||
b e 4 | ||
c d 3 | ||
c e 40 | ||
f g 1 | ||
g h 1 | ||
h f 1 |
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 @@ | ||
3 |
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 @@ | ||
2 |
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,6 @@ | ||
a b 1 | ||
a e 5 | ||
b c 2 | ||
b e 4 | ||
c d 3 | ||
c e 40 |
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,17 @@ | ||
// Find the highest in and out degree nodes in the graph | ||
.type Node | ||
|
||
.decl Edge(n:Node, m:Node, w:number) input | ||
|
||
.decl OutDegree(n:Node, l:number) | ||
OutDegree(x, l) :- Edge(x, _, _), l = sum 1 : Edge(x, _, _). | ||
|
||
.decl InDegree(n:Node, l:number) | ||
InDegree(x, l) :- Edge(_, x, _), l = sum 1 : Edge(_, x, _). | ||
|
||
.decl HighestOutDegree(d:number) output | ||
HighestOutDegree(d) :- OutDegree(_, _), d = max D : OutDegree(_, D). | ||
|
||
.decl HighestInDegree(d:number) output | ||
HighestInDegree(d) :- InDegree(_, _), d = max D : InDegree(_, D). | ||
|
Empty file.
Empty file.
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,3 @@ | ||
a 1 | ||
b 2 | ||
c 3 |
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,6 @@ | ||
a b 1 | ||
a e 5 | ||
b c 2 | ||
b e 4 | ||
c d 3 | ||
c e 40 |
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 @@ | ||
// Find the shortest outward edge for every Node | ||
.type Node | ||
|
||
.decl Edge(n:Node, m:Node, w:number) input | ||
|
||
.decl ShortestEdgeFromN(n:Node, l:number) output | ||
|
||
ShortestEdgeFromN(x, l) :- Edge(x, _, _), l = min Z : Edge(x, _, Z). |
Empty file.
Empty file.
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,9 @@ | ||
a b 1 | ||
a e 5 | ||
b c 2 | ||
b e 4 | ||
c d 3 | ||
c e 40 | ||
a c 3 | ||
b d 5 | ||
a d 6 |
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,6 @@ | ||
a b 1 | ||
a e 5 | ||
b c 2 | ||
b e 4 | ||
c d 3 | ||
c e 40 |
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,13 @@ | ||
// Find the shortest paths between all nodes, the slow way | ||
.type Node | ||
|
||
.decl Edge(n:Node, m:Node, w:number) input | ||
|
||
// Find all paths | ||
.decl Length (n:Node, m:Node, l:number) | ||
Length(x,y,t) :- t=l, Edge(x,y,l). | ||
Length(x,y,t+l) :- Edge(x,z,l), Length(z,y,t). | ||
|
||
// Filter out the longest path | ||
.decl ShortestPath(n:Node, m:Node, l:number) output | ||
ShortestPath(x, y, a) :- Length(x, y, _), a = min Z : Length(x, y, Z). |
Empty file.
Empty file.