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
8fa384ab
Commit
8fa384ab
authored
13 years ago
by
Ant01n3
Browse files
Options
Downloads
Patches
Plain Diff
Documented the GridGenerator.
parent
b7086742
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/org/graphstream/algorithm/generator/BarabasiAlbertGenerator.java
+6
-0
6 additions, 0 deletions
...phstream/algorithm/generator/BarabasiAlbertGenerator.java
src/org/graphstream/algorithm/generator/GridGenerator.java
+59
-2
59 additions, 2 deletions
src/org/graphstream/algorithm/generator/GridGenerator.java
with
65 additions
and
2 deletions
src/org/graphstream/algorithm/generator/BarabasiAlbertGenerator.java
+
6
−
0
View file @
8fa384ab
...
...
@@ -28,6 +28,12 @@ import java.util.LinkedList;
* new node, use {@link #setExactlyMaxLinksPerStep(boolean)}.
* </p>
*
* <h2>Complexity</h2>
*
* For each new step, the algorithm act in O(n) with n the number of
* nodes if 1 max edge per new node is created, else the complexity
* is O(nm) if m max edge per new node is created.
*
* <h2>Example</h2>
*
* <pre>
...
...
This diff is collapsed.
Click to expand it.
src/org/graphstream/algorithm/generator/GridGenerator.java
+
59
−
2
View file @
8fa384ab
...
...
@@ -31,9 +31,66 @@
package
org.graphstream.algorithm.generator
;
/**
* Generator for
grids
.
* Generator for
square grids of any size
.
*
* TODO add 3d generation
* <p>
* This generate square grid graphs of any size with each node not on the
* border of the graph having four neighbours for regular grids or
* height neighbours for cross grids. The nodes at each of the four
* corners of the grid consequently have only two or three (cross)
* neighbours. The nodes on the side of the grid have three or five (cross)
* neighbours.
* </p>
*
* <p>
* The generated grid can be closed as a torus, meaning that there is
* no border nodes will exist, therefore all nodes will have the same
* degree four or height (cross).
* </p>
*
* <h2>Usage</h2>
*
* <p>
* At the contrary of most generators, this generator does not produce
* only one node when you call {@link #nextEvents()}. It adds a row
* and column to the grid, making the side of the square grow by one.
* Therfore if you call the {@link #nextEvents()} methode n times you
* will have n^2 nodes.
* </p>
*
* <p>
* You can indicate at construction time if the graph will be a regular
* grid (no argument) or if it must be a cross-grid (first boolean argument to
* true) and a tore (second boolean argument to true).
* </p>
*
* <p>
* A constructor with a third boolean parameter allows to indicate that nodes
* must have a ``xyz`` attribute to position them or not. This is the default
* behaviour.
* </p>
*
* <h2>Complexity</h2>
*
* At each call to {@link #nextEvents()} ((n+1)*2) new nodes are generated
* with n the size of a side of the grid.
*
* <h2>Example</h2>
*
* <pre>
* Graph graph = new SingleGraph("grid");
* Generator gen = GridGenerator();
*
* gen.addSink(graph);
* gen.begin();
* for(int i=0; i<10; i++) {
* gen.nextEvents();
* }
* gen.end();
*
* // Nodes already have a position.
* graph.display(false);
* </pre>
*
* @since 2007
*/
...
...
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