Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sasa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
verimag
synchrone
sasa
Commits
165928b5
"README.md" did not exist on "7cfac339e486508d819851d49e45d0324f56a426"
Commit
165928b5
authored
4 years ago
by
erwan
Browse files
Options
Downloads
Patches
Plain Diff
gg: fix the computation of degrees for rings
parent
7e901f5b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/sasacore/topology.ml
+17
-12
17 additions, 12 deletions
lib/sasacore/topology.ml
tools/gg/classicGraph.ml
+22
-5
22 additions, 5 deletions
tools/gg/classicGraph.ml
with
39 additions
and
17 deletions
lib/sasacore/topology.ml
+
17
−
12
View file @
165928b5
(* Time-stamp: <modified the
24/08
/2020 (at
1
1:
2
5) by Erwan Jahier> *)
(* Time-stamp: <modified the
09/11
/2020 (at
2
1:5
8
) by Erwan Jahier> *)
open
Graph
open
Graph
.
Dot_ast
...
...
@@ -157,17 +157,22 @@ let (to_adjacency: t -> bool array array) =
)
t
.
nodes
;
m
let
(
get_degree
:
t
->
int
*
int
)
=
fun
t
->
if
t
.
nodes
=
[]
then
0
,
0
else
let
node_deg
n
=
List
.
length
(
t
.
succ
(
n
.
id
))
in
let
d_start
=
node_deg
((
List
.
hd
t
.
nodes
))
in
List
.
fold_left
(
fun
(
d_min
,
d_max
)
n
->
(
min
(
node_deg
n
)
d_min
,
max
(
node_deg
n
)
d_max
)
)
(
d_start
,
d_start
)
(
List
.
tl
t
.
nodes
)
let
(
get_degree
:
t
->
int
*
int
)
=
fun
t
->
match
t
.
nodes
with
|
[]
->
0
,
0
|
n
::
tl
->
let
node_deg
n
=
List
.
length
(
t
.
succ
(
n
.
id
))
in
let
d0
=
node_deg
n
in
let
dmin
,
dmax
=
List
.
fold_left
(
fun
(
d_min
,
d_max
)
n
->
(
min
(
node_deg
n
)
d_min
,
max
(
node_deg
n
)
d_max
)
)
(
d0
,
d0
)
tl
in
if
t
.
directed
then
2
*
dmin
,
2
*
dmax
else
dmin
,
dmax
let
(
get_nb_link
:
t
->
int
)
=
fun
t
->
...
...
This diff is collapsed.
Click to expand it.
tools/gg/classicGraph.ml
+
22
−
5
View file @
165928b5
...
...
@@ -45,20 +45,37 @@ let (gen_star: bool -> int -> Topology.t) =
attributes
=
[]
}
let
neighbours_ring
:
(
node_id
list
->
(
node_id
->
(
int
*
node_id
)
list
))
=
fun
nodes
->
let
rec
list_iter3
f
l1
l2
l3
=
match
(
l1
,
l2
,
l3
)
with
([]
,
[]
,
[]
)
->
()
|
(
a1
::
l1
,
a2
::
l2
,
a3
::
l3
)
->
f
a1
a2
a3
;
list_iter3
f
l1
l2
l3
|
(
_
,
_
,
_
)
->
invalid_arg
"list_iter3"
let
neighbours_ring
:
bool
->
(
node_id
list
->
(
node_id
->
(
int
*
node_id
)
list
))
=
fun
dir
nodes
->
let
node_succ
:
node_succ_t
=
Hashtbl
.
create
(
length
nodes
)
in
let
nodes2
=
(
List
.
tl
nodes
)
@
[
List
.
hd
nodes
]
in
List
.
iter2
(
fun
n1
n2
->
Hashtbl
.
replace
node_succ
n1
[
1
,
n2
])
nodes
nodes2
;
let
nodes2
,
nodes3
=
match
nodes
with
|
n1
::
n2
::
t
->
(
n2
::
t
)
@
[
n1
]
,
t
@
[
n1
;
n2
]
|
_
->
assert
false
in
list_iter3
(
fun
n1
n2
n3
->
if
dir
then
Hashtbl
.
replace
node_succ
n2
[
1
,
n3
]
else
Hashtbl
.
replace
node_succ
n2
[(
1
,
n3
);(
1
,
n1
)]
)
nodes
nodes2
nodes3
;
(
fun
n
->
try
Hashtbl
.
find
node_succ
n
with
Not_found
->
[]
)
let
(
gen_ring
:
bool
->
int
->
Topology
.
t
)
=
fun
directed
nb
->
let
nodes
=
(
create_nodes
"p"
(
0
,
nb
))
in
let
nl
=
id_to_empty_nodes
nodes
in
{
nodes
=
nl
;
succ
=
neighbours_ring
nodes
;
succ
=
neighbours_ring
directed
nodes
;
of_id
=
get_of_id
nl
;
directed
=
directed
;
attributes
=
[]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment