|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbcds.phison.io.GraphWriter<V,E>
bcds.phison.io.GraphMLWriter<V,E>
public class GraphMLWriter<V extends GraphIONode,E>
Writes a SimGraph to a GraphML file.
The nodes of the graph to be exported must implement GraphIONode
.
The primary purpose of this
class is to attain minimal interoperability with other software packages
that can read the GraphML.
That is, the most important information conveyed in the output
file is the adjacency matrix. Beyond that, no effort is made to
harmonize attribute names or types with other packages.
The node attributes written are: xcoord (int), ycoord (int), and label (string).
The edge attributes written are: capacity (int) and cost (float).
The cost attribute is written only if the cost map is not null
(see GraphWriter.setCostMap(Map)
).
The traffic matrix is never written, that is, it is silently discarded.
The GraphML file format is described here.
Constructor Summary | |
---|---|
GraphMLWriter(SimGraph<V,E> g)
Creates a new writer instance for the graph g and
sets the output to System.out . |
|
GraphMLWriter(java.lang.String fname,
SimGraph<V,E> g)
Creates a new writer instance for the graph g and
sets the output to the file fname . |
|
GraphMLWriter(java.io.Writer out,
SimGraph<V,E> g)
Creates a new writer instance for the graph g and
sets the output to out . |
Method Summary | |
---|---|
void |
writeAll()
Writes the full GrapphML file. |
Methods inherited from class bcds.phison.io.GraphWriter |
---|
printf, setCapacityMap, setCostMap, setHeadingComment, setNetName, setTrafficMatrix, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GraphMLWriter(SimGraph<V,E> g)
g
and
sets the output to System.out
.
public GraphMLWriter(java.lang.String fname, SimGraph<V,E> g)
g
and
sets the output to the file fname
.
AnyException
- if an IO error occurs during file opening/creation.public GraphMLWriter(java.io.Writer out, SimGraph<V,E> g)
g
and
sets the output to out
.
Method Detail |
---|
public void writeAll()
writeHeader()
, writeNodes()
and
writeEdges()
in sequence, followed by a flush.
AnyException
- wrapping an IOExeption if any IO
error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |