peersim.dynamics
Class WireFromFile
java.lang.Object
peersim.dynamics.WireGraph
peersim.dynamics.WireFromFile
- All Implemented Interfaces:
- Control
public class WireFromFile
- extends WireGraph
Takes a Linkable
protocol and adds connections that are stored in a
file. Note that no
connections are removed, they are only added. So it can be used in
combination with other initializers.
The format of the file is as follows. Each line begins with a node ID
(IDs start from 0) followed by a list of neighbors, separated by whitespace.
All node IDs larger than the actual network size will be discarded, but
it does not trigger an error. Lines starting with a "#" character and
empty lines are ignored.
Parameter Summary |
file
The filename to load links from. |
k
The number of neighbors to be read from the file. |
Constructor Summary |
WireFromFile(java.lang.String prefix)
Standard constructor that reads the configuration parameters. |
Method Summary |
void |
wire(Graph g)
Wires the graph from a file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
file
- The filename to load links from.
k
- The number of neighbors to be read from the file. If unset, the default
behavior is to read all links in the file. If set, then the first k
neighbors will be read only.
WireFromFile
public WireFromFile(java.lang.String prefix)
- Standard constructor that reads the configuration parameters.
Invoked by the simulation engine.
- Parameters:
prefix
- the configuration prefix for this class
wire
public void wire(Graph g)
- Wires the graph from a file.
The format of the file is as follows. Each line begins with a node ID
(IDs start from 0) followed by a list of neighbors, separated by whitespace.
All node IDs larger than the actual network size will be discarded, but
it does not trigger an error. Lines starting with a "#" character and
empty lines are ignored.
- Specified by:
wire
in class WireGraph