Class CSVImporter<V,E>
- java.lang.Object
-
- org.jgrapht.io.CSVImporter<V,E>
-
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
GraphImporter<V,E>
@Deprecated public class CSVImporter<V,E> extends Object implements GraphImporter<V,E>
Deprecated.UseCSVImporter
insteadImports a graph from a CSV Format or any other Delimiter-separated value format.The importer supports various different formats which can be adjusted using the
setFormat
method. The supported formats are the same CSV formats used by Gephi . For some of the formats, the behavior of the importer can be adjusted using thesetParameter
method. SeeCSVFormat
for a description of the formats.The importer respects rfc4180. The caller can also adjust the separator to something like semicolon or pipe instead of comma. In such a case, all fields are unescaped using the new separator. See Delimiter- separated values for more information.
This importer does not distinguish between
CSVFormat.EDGE_LIST
andCSVFormat.ADJACENCY_LIST
. In both cases it assumes the format isCSVFormat.ADJACENCY_LIST
.- Author:
- Dimitrios Michail
- See Also:
CSVFormat
-
-
Field Summary
Fields Modifier and Type Field Description protected EdgeProvider<V,E>
edgeProvider
Deprecated.Constructs new edgesprotected ComponentUpdater<Graph<V,E>>
graphUpdater
Deprecated.Updates graph propertiesprotected VertexProvider<V>
vertexProvider
Deprecated.Constructs new verticesprotected ComponentUpdater<V>
vertexUpdater
Deprecated.Updates already constructed vertices
-
Constructor Summary
Constructors Constructor Description CSVImporter(VertexProvider<V> vertexProvider, EdgeProvider<V,E> edgeProvider)
Deprecated.Constructs a new importer using theCSVFormat.ADJACENCY_LIST
format as default.CSVImporter(VertexProvider<V> vertexProvider, EdgeProvider<V,E> edgeProvider, CSVFormat format)
Deprecated.Constructs a new importer.CSVImporter(VertexProvider<V> vertexProvider, EdgeProvider<V,E> edgeProvider, CSVFormat format, char delimiter)
Deprecated.Constructs a new importer.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description char
getDelimiter()
Deprecated.Get the delimiter (comma, semicolon, pipe, etc).EdgeProvider<V,E>
getEdgeProvider()
Deprecated.Get the edge providerCSVFormat
getFormat()
Deprecated.Get the format that the importer is using.ComponentUpdater<Graph<V,E>>
getGraphUpdater()
Deprecated.Get the graph updater.VertexProvider<V>
getVertexProvider()
Deprecated.Get the vertex providerComponentUpdater<V>
getVertexUpdater()
Deprecated.Get the vertex updatervoid
importGraph(Graph<V,E> graph, Reader input)
Deprecated.Import a graph.boolean
isParameter(CSVFormat.Parameter p)
Deprecated.Return if a particular parameter of the exporter is enabledvoid
setDelimiter(char delimiter)
Deprecated.Set the delimiter (comma, semicolon, pipe, etc).void
setEdgeProvider(EdgeProvider<V,E> edgeProvider)
Deprecated.Set the edge provider.void
setFormat(CSVFormat format)
Deprecated.Set the format of the importervoid
setGraphUpdater(ComponentUpdater<Graph<V,E>> graphUpdater)
Deprecated.Set the graph updater.void
setParameter(CSVFormat.Parameter p, boolean value)
Deprecated.Set the value of a parameter of the exportervoid
setVertexProvider(VertexProvider<V> vertexProvider)
Deprecated.Set the vertex providervoid
setVertexUpdater(ComponentUpdater<V> vertexUpdater)
Deprecated.Set the vertex updater.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jgrapht.io.GraphImporter
importGraph, importGraph
-
-
-
-
Field Detail
-
vertexProvider
protected VertexProvider<V> vertexProvider
Deprecated.Constructs new vertices
-
edgeProvider
protected EdgeProvider<V,E> edgeProvider
Deprecated.Constructs new edges
-
vertexUpdater
protected ComponentUpdater<V> vertexUpdater
Deprecated.Updates already constructed vertices
-
graphUpdater
protected ComponentUpdater<Graph<V,E>> graphUpdater
Deprecated.Updates graph properties
-
-
Constructor Detail
-
CSVImporter
public CSVImporter(VertexProvider<V> vertexProvider, EdgeProvider<V,E> edgeProvider)
Deprecated.Constructs a new importer using theCSVFormat.ADJACENCY_LIST
format as default.- Parameters:
vertexProvider
- provider for the generation of vertices. Must not be null.edgeProvider
- provider for the generation of edges. Must not be null.
-
CSVImporter
public CSVImporter(VertexProvider<V> vertexProvider, EdgeProvider<V,E> edgeProvider, CSVFormat format)
Deprecated.Constructs a new importer.- Parameters:
vertexProvider
- provider for the generation of vertices. Must not be null.edgeProvider
- provider for the generation of edges. Must not be null.format
- format to use out of the supported ones
-
CSVImporter
public CSVImporter(VertexProvider<V> vertexProvider, EdgeProvider<V,E> edgeProvider, CSVFormat format, char delimiter)
Deprecated.Constructs a new importer.- Parameters:
vertexProvider
- provider for the generation of vertices. Must not be null.edgeProvider
- provider for the generation of edges. Must not be null.format
- format to use out of the supported onesdelimiter
- delimiter to use (comma, semicolon, pipe, etc.)
-
-
Method Detail
-
getFormat
public CSVFormat getFormat()
Deprecated.Get the format that the importer is using.- Returns:
- the input format
-
setFormat
public void setFormat(CSVFormat format)
Deprecated.Set the format of the importer- Parameters:
format
- the format to use
-
getDelimiter
public char getDelimiter()
Deprecated.Get the delimiter (comma, semicolon, pipe, etc).- Returns:
- the delimiter
-
setDelimiter
public void setDelimiter(char delimiter)
Deprecated.Set the delimiter (comma, semicolon, pipe, etc).- Parameters:
delimiter
- the delimiter to use
-
isParameter
public boolean isParameter(CSVFormat.Parameter p)
Deprecated.Return if a particular parameter of the exporter is enabled- Parameters:
p
- the parameter- Returns:
true
if the parameter is set,false
otherwise
-
setParameter
public void setParameter(CSVFormat.Parameter p, boolean value)
Deprecated.Set the value of a parameter of the exporter- Parameters:
p
- the parametervalue
- the value to set
-
importGraph
public void importGraph(Graph<V,E> graph, Reader input) throws ImportException
Deprecated.Import a graph.The provided graph must be able to support the features of the graph that is read. For example if the input contains self-loops then the graph provided must also support self-loops. The same for multiple edges.
If the provided graph is a weighted graph, the importer also reads edge weights.
- Specified by:
importGraph
in interfaceGraphImporter<V,E>
- Parameters:
graph
- the graphinput
- the input reader- Throws:
ImportException
- in case an error occurs, such as I/O or parse error
-
getVertexProvider
public VertexProvider<V> getVertexProvider()
Deprecated.Get the vertex provider- Returns:
- the vertex provider
-
setVertexProvider
public void setVertexProvider(VertexProvider<V> vertexProvider)
Deprecated.Set the vertex provider- Parameters:
vertexProvider
- the new vertex provider. Must not be null.
-
getEdgeProvider
public EdgeProvider<V,E> getEdgeProvider()
Deprecated.Get the edge provider- Returns:
- The edge provider
-
setEdgeProvider
public void setEdgeProvider(EdgeProvider<V,E> edgeProvider)
Deprecated.Set the edge provider.- Parameters:
edgeProvider
- the new edge provider. Must not be null.
-
getVertexUpdater
public ComponentUpdater<V> getVertexUpdater()
Deprecated.Get the vertex updater- Returns:
- the vertex updater
-
setVertexUpdater
public void setVertexUpdater(ComponentUpdater<V> vertexUpdater)
Deprecated.Set the vertex updater.- Parameters:
vertexUpdater
- the new vertex updater. Must not be null.
-
getGraphUpdater
public ComponentUpdater<Graph<V,E>> getGraphUpdater()
Deprecated.Get the graph updater.- Returns:
- the graph updater
-
setGraphUpdater
public void setGraphUpdater(ComponentUpdater<Graph<V,E>> graphUpdater)
Deprecated.Set the graph updater.- Parameters:
graphUpdater
- the new graph updater. Must not be null.
-
-