bcds.phison.io
Class GraphMLReader<V extends GraphIONode,E>
java.lang.Object
bcds.phison.io.GraphReader<V,E>
bcds.phison.io.GraphMLReader<V,E>
public class GraphMLReader<V extends GraphIONode,E>
- extends GraphReader<V,E>
A basic GraphML file reader.
Reads the node and link definitions of a GraphML file.
The "traffic matrix" or any node-pair attribute is NOT read.
Note that error diagnostic is very poor: not even the line
number where the error is detected can be identified (all thanks
to the "glorious" XML and the libraries that "parse" it).
Litte semantic checking, if any, is performed. For example,
if a node has a missing "data" tag (attributes), but thereafter
exists some unprocessed tag (let's say "xyzabc") that is followed
by a "data" tag, it will happily asociate this "data" tag to the
lastly-processed node.
Unlike other graph readers in this package, GraphMLReader
does not check that all requested "sections" were successfully read.
This check is omitted so that foreign topologies can be read and
completed, if necessary, with capacity or cost attributes.
See for example the tool CapacityChanger
,
which can change (or set) link capacities en masse.
- Author:
- Juan Segovia S.
Method Summary |
void |
run()
Reads the GraphML file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GraphMLReader
public GraphMLReader(java.lang.String fname,
SimGraph<V,E> g)
- Creates a new reader. The actual reading is performed
with
run()
.
- Parameters:
fname
- the XML file to read from. As the actual
reading is performed
through DataFileReader
,
on-the-fly decompression (GZIP) is supported.g
- the graph to be populated. Normally, it should be an emtpy
(newly created) graph.
run
public void run()
- Reads the GraphML file.
- Specified by:
run
in class GraphReader<V extends GraphIONode,E>
- Throws:
AnyException
- wrapping an SAXException if that is thrown
by the SAX parser.
AnyException
- wrapping an IOException if the parser
encounters an IO error.