Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-orbit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Katerina Roukounaki
cloud-orbit
Commits
fb70c5a1
Commit
fb70c5a1
authored
Nov 13, 2014
by
Aggelos Giantsios
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Vertex type
Export Vertex from Table module and amend the existing type signatures
parent
48f31143
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
Table.hs
Table.hs
+9
-5
No files found.
Table.hs
View file @
fb70c5a1
--
--
-- orbit-int hash table (storing vertices on a worker)
-- orbit-int hash table (storing vertices on a worker)
--
--
module
Table
(
new
module
Table
(
Freq
,
VTable
,
Vertex
,
new
,
to_list
,
to_list
,
is_member
,
is_member
,
insert
,
insert
...
@@ -21,7 +24,8 @@ module Table( new
...
@@ -21,7 +24,8 @@ module Table( new
import
Data.Array
(
Array
,
elems
,
listArray
,
(
!
),
(
//
))
import
Data.Array
(
Array
,
elems
,
listArray
,
(
!
),
(
//
))
type
Freq
=
[
Int
]
type
Freq
=
[
Int
]
type
VTable
=
Array
Int
[
Int
]
type
Vertex
=
Int
type
VTable
=
Array
Int
[
Vertex
]
-- Note: Hash tables have a fixed number of slots but each slot can store
-- Note: Hash tables have a fixed number of slots but each slot can store
-- a list of vertices. The functions is_member/3 and insert/3
-- a list of vertices. The functions is_member/3 and insert/3
...
@@ -32,15 +36,15 @@ new :: Int -> VTable
...
@@ -32,15 +36,15 @@ new :: Int -> VTable
new
size
=
listArray
(
0
,
size
-
1
)
$
cycle
[
[]
]
new
size
=
listArray
(
0
,
size
-
1
)
$
cycle
[
[]
]
-- to_list(T) converts a table T into a list of its entries.
-- to_list(T) converts a table T into a list of its entries.
to_list
::
VTable
->
[
Int
]
to_list
::
VTable
->
[
Vertex
]
to_list
=
concat
.
elems
to_list
=
concat
.
elems
-- is_member(X, I, T) is true iff X is stored in table T at slot I.
-- is_member(X, I, T) is true iff X is stored in table T at slot I.
is_member
::
Int
->
Int
->
VTable
->
Bool
is_member
::
Vertex
->
Int
->
VTable
->
Bool
is_member
x
i
t
=
elem
x
(
t
!
i
)
is_member
x
i
t
=
elem
x
(
t
!
i
)
-- insert(X, I, T) inserts X into table T at slot I.
-- insert(X, I, T) inserts X into table T at slot I.
insert
::
Int
->
Int
->
VTable
->
VTable
insert
::
Vertex
->
Int
->
VTable
->
VTable
insert
x
i
t
=
t
//
[(
i
,
x
:
t
!
i
)]
insert
x
i
t
=
t
//
[(
i
,
x
:
t
!
i
)]
-- get_freq computes the fill frequency of table T;
-- get_freq computes the fill frequency of table T;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment