G
- The graph type to be read from the GraphML fileV
- the vertex type
The vertex type used by the graphV
- the edge type
The edge type used by the graphpublic class GraphMLReader2<G extends Hypergraph<V,E>,V,E> extends Object implements GraphReader<G,V,E>
Note that the user is responsible for supplying a graph
Transformer
that will create graphs capable of supporting the
edge types in the supplied GraphML file. If the graph generated by the
Factory
is not compatible (for example: if the graph does not
accept directed edges, and the GraphML file contains a directed edge) then
the results are graph-implementation-dependent.
Modifier and Type | Field and Description |
---|---|
protected GraphMLDocument |
document |
protected com.google.common.base.Function<EdgeMetadata,E> |
edgeTransformer |
protected Reader |
fileReader |
protected com.google.common.base.Function<GraphMetadata,G> |
graphTransformer |
protected com.google.common.base.Function<HyperEdgeMetadata,E> |
hyperEdgeTransformer |
protected boolean |
initialized |
protected ElementParserRegistry<G,V,E> |
parserRegistry |
protected com.google.common.base.Function<NodeMetadata,V> |
vertexTransformer |
protected javax.xml.stream.XMLEventReader |
xmlEventReader |
Constructor and Description |
---|
GraphMLReader2(Reader fileReader,
com.google.common.base.Function<GraphMetadata,G> graphTransformer,
com.google.common.base.Function<NodeMetadata,V> vertexTransformer,
com.google.common.base.Function<EdgeMetadata,E> edgeTransformer,
com.google.common.base.Function<HyperEdgeMetadata,E> hyperEdgeTransformer)
Constructs a GraphML reader around the given reader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the GraphML reader and disposes of any resources.
|
com.google.common.base.Function<EdgeMetadata,E> |
getEdgeTransformer()
Gets the current Function that is being used for edge objects.
|
GraphMLDocument |
getGraphMLDocument()
Returns the object that contains the metadata read in from the GraphML
document
|
com.google.common.base.Function<GraphMetadata,G> |
getGraphTransformer()
Gets the current Function that is being used for graph objects.
|
com.google.common.base.Function<HyperEdgeMetadata,E> |
getHyperEdgeTransformer()
Gets the current Function that is being used for hyperedge objects.
|
com.google.common.base.Function<NodeMetadata,V> |
getVertexTransformer()
Gets the current Function that is being used for vertex objects.
|
void |
init()
Verifies the object state and initializes this reader.
|
G |
readGraph()
Reads a single graph object from the GraphML document.
|
protected javax.xml.stream.XMLEventReader xmlEventReader
protected Reader fileReader
protected com.google.common.base.Function<GraphMetadata,G extends Hypergraph<V,E>> graphTransformer
protected com.google.common.base.Function<NodeMetadata,V> vertexTransformer
protected com.google.common.base.Function<EdgeMetadata,E> edgeTransformer
protected com.google.common.base.Function<HyperEdgeMetadata,E> hyperEdgeTransformer
protected boolean initialized
protected final GraphMLDocument document
protected final ElementParserRegistry<G extends Hypergraph<V,E>,V,E> parserRegistry
public GraphMLReader2(Reader fileReader, com.google.common.base.Function<GraphMetadata,G> graphTransformer, com.google.common.base.Function<NodeMetadata,V> vertexTransformer, com.google.common.base.Function<EdgeMetadata,E> edgeTransformer, com.google.common.base.Function<HyperEdgeMetadata,E> hyperEdgeTransformer)
fileReader
- the reader for the input GraphML document.graphTransformer
- Transformation function to convert from GraphML GraphMetadata
to graph objects. This must be non-null.vertexTransformer
- Transformation function to convert from GraphML NodeMetadata
to vertex objects. This must be non-null.edgeTransformer
- Transformation function to convert from GraphML EdgeMetadata
to edge objects. This must be non-null.hyperEdgeTransformer
- Transformation function to convert from GraphML
HyperEdgeMetadata to edge objects. This must be non-null.IllegalArgumentException
- thrown if any of the arguments are null.public com.google.common.base.Function<GraphMetadata,G> getGraphTransformer()
public com.google.common.base.Function<NodeMetadata,V> getVertexTransformer()
public com.google.common.base.Function<EdgeMetadata,E> getEdgeTransformer()
public com.google.common.base.Function<HyperEdgeMetadata,E> getHyperEdgeTransformer()
public void init() throws GraphIOException
GraphReaderException
will be thrown. This method may be called more than once.
Successive calls will have no effect.GraphIOException
- thrown if an error occurred.public void close() throws GraphIOException
close
in interface GraphReader<G extends Hypergraph<V,E>,V,E>
GraphIOException
- thrown if an error occurs.public GraphMLDocument getGraphMLDocument()
public G readGraph() throws GraphIOException
init
to initialize the state of the reader.readGraph
in interface GraphReader<G extends Hypergraph<V,E>,V,E>
GraphIOException
- thrown if an error occurred.Copyright © 2015. All rights reserved.