Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gs-algo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graphstream
gs-algo
Commits
a8c2d4e4
Commit
a8c2d4e4
authored
13 years ago
by
gsavin
Browse files
Options
Downloads
Patches
Plain Diff
Add constructors to customize maxDistance and maxDegree.
parent
2fe540ea
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/org/graphstream/algorithm/generator/LobsterGenerator.java
+27
-2
27 additions, 2 deletions
...org/graphstream/algorithm/generator/LobsterGenerator.java
with
27 additions
and
2 deletions
src/org/graphstream/algorithm/generator/LobsterGenerator.java
+
27
−
2
View file @
a8c2d4e4
...
...
@@ -68,7 +68,32 @@ public class LobsterGenerator extends BaseGenerator {
* Main constructor to a Lobster generator.
*/
public
LobsterGenerator
()
{
nodes
=
new
LinkedList
<
Data
>();
this
(
2
,
-
1
);
}
/**
* Constructor allowing to customize maximum distance to the root path and
* maximum degree of nodes.
*
* @param maxDistance
* max distance to root path
* @param maxDegree
* max degree of nodes
*/
public
LobsterGenerator
(
int
maxDistance
,
int
maxDegree
)
{
this
.
maxDistance
=
maxDistance
;
this
.
maxDegree
=
maxDegree
;
this
.
nodes
=
new
LinkedList
<
Data
>();
}
/**
* Constructor allowing to customize maximum distance to the root path.
*
* @param maxDistance
* max distance to root path
*/
public
LobsterGenerator
(
int
maxDistance
)
{
this
(
maxDistance
,
-
1
);
}
/*
...
...
@@ -92,7 +117,7 @@ public class LobsterGenerator extends BaseGenerator {
do
{
connectTo
=
nodes
.
get
(
random
.
nextInt
(
nodes
.
size
()));
}
while
(
connectTo
.
distance
>=
maxDistance
||
connectTo
.
degree
()
>=
maxDegree
);
||
(
maxDegree
>
0
&&
connectTo
.
degree
()
>=
maxDegree
)
)
;
Data
newData
=
null
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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