Package com.gengoai.graph.io
Interface GraphReader<V>
-
- Type Parameters:
V
- the vertex type
- All Known Implementing Classes:
GraphJson
public interface GraphReader<V>
Common interface for reading graphs from resources.
Readers first read in the graph constructing intermediate
Vertex
objects to represent vertices and their properties.Vertex
objects are then decoded into an actual vertex using a suppliedVertexDecoder
. Similarly, edges are constructed using the graph's edge factory, but anEdgeDecoder
is used to add additional properties stored in a map to the edge.- Author:
- David B. Bracewell
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Graph<V>
read(Resource location)
Reads a graph in from a resourcevoid
setEdgeDecoder(EdgeDecoder<V> edgeDecoder)
Sets the edge decoder.void
setVertexDecoder(VertexDecoder<V> vertexDecoder)
Sets the vertex decoder.
-
-
-
Method Detail
-
setVertexDecoder
void setVertexDecoder(VertexDecoder<V> vertexDecoder)
Sets the vertex decoder.- Parameters:
vertexDecoder
- the vertex decoder
-
setEdgeDecoder
void setEdgeDecoder(EdgeDecoder<V> edgeDecoder)
Sets the edge decoder.- Parameters:
edgeDecoder
- the edge decoder
-
read
Graph<V> read(Resource location) throws IOException
Reads a graph in from a resource- Parameters:
location
- the location of the graph- Returns:
- A Graph constructed based on the resource
- Throws:
IOException
- Something went wrong reading
-
-