|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbcds.phison.io.GraphReader<V,E>
bcds.phison.io.SgfGraphReader<V,E>
bcds.phison.io.NetGraphReader<V,E>
public class NetGraphReader<V extends GraphIONode,E>
Reads a topology file in .net format. The following example illustrates the overall structure of a .net file:
[netname] somename # Purely informational. It is never used. [nodenum] # Number of nodes. Three, in this example. 3 [coordinates] # This section lists the nodes. # xcoord ycoord label 0.0 0.0 London 1.5 -3.5 Madrid -2.1 4.7 Paris [capacity] # Defines the adjacency matrix and link capacity. # This defines a "ring" among the three nodes. 0 10 20 10 0 5 20 5 0 [cost] # For example, physical distance in km. 0 1200 180 1200 0 800 180 800 0 [traffic] # In this example, only nodes 0-1 and 1-2 have entries. 0 30 0 # 0 30 0 10 # 1 0 10 0 # 2The order of the sections is irrelevant, but it is recommended that [nodenum] appears as soon as possible (that section needs to be read before the rest, which opens the possiblity for multiple passes over the whole file).
Other considerations:
The .net and .sgf file formats have many features in common. More information on the .sgf format can be found here.
| Constructor Summary | |
|---|---|
NetGraphReader(java.lang.String fname,
SimGraph<V,E> g)
Creates a NetGraphReader so that a later call to run() will
populate the graph g from the file named fname. |
|
| Method Summary | |
|---|---|
void |
run()
Reads the file and populates the SimGraph g and the
maps corresponding to edge or node pair attributes. |
| Methods inherited from class bcds.phison.io.GraphReader |
|---|
getIdToNodeMap, getNode, markEdgeAttr, markNodePairAttr, raiseBadFormatEx, setInputStream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NetGraphReader(java.lang.String fname,
SimGraph<V,E> g)
run() will
populate the graph g from the file named fname.
Beware that this class cannot read from "-" (that is, stdin/System.in) because rewind is necessary to make multiple passes on the file, and stdin does not support that operation.
AnyException - wrappin an IOException if
opening fname for reading fails for any reason.| Method Detail |
|---|
public void run()
g and the
maps corresponding to edge or node pair attributes.
run in class SgfGraphReader<V extends GraphIONode,E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||