V
- the graph vertex typeE
- the graph edge typeCSVImporter
instead.@Deprecated public class CSVImporter<V,E> extends Object implements GraphImporter<V,E>
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 the
setParameter
method. See
CSVFormat
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
and
CSVFormat.ADJACENCY_LIST
. In both cases it assumes the format is
CSVFormat.ADJACENCY_LIST
.
CSVFormat
Constructor and Description |
---|
CSVImporter(VertexProvider<V> vertexProvider,
EdgeProvider<V,E> edgeProvider)
Deprecated.
Constructs a new importer using the
CSVFormat.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.
|
Modifier and Type | Method and Description |
---|---|
char |
getDelimiter()
Deprecated.
Get the delimiter (comma, semicolon, pipe, etc).
|
CSVFormat |
getFormat()
Deprecated.
Get the format that the importer is using.
|
void |
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 enabled
|
void |
setDelimiter(char delimiter)
Deprecated.
Set the delimiter (comma, semicolon, pipe, etc).
|
void |
setFormat(CSVFormat format)
Deprecated.
Set the format of the importer
|
void |
setParameter(CSVFormat.Parameter p,
boolean value)
Deprecated.
Set the value of a parameter of the exporter
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
importGraph, importGraph
public CSVImporter(VertexProvider<V> vertexProvider, EdgeProvider<V,E> edgeProvider)
CSVFormat.ADJACENCY_LIST
format as default.vertexProvider
- provider for the generation of vertices. Must not be null.edgeProvider
- provider for the generation of edges. Must not be null.public CSVImporter(VertexProvider<V> vertexProvider, EdgeProvider<V,E> edgeProvider, CSVFormat format)
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 onespublic CSVImporter(VertexProvider<V> vertexProvider, EdgeProvider<V,E> edgeProvider, CSVFormat format, char delimiter)
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.)public CSVFormat getFormat()
public void setFormat(CSVFormat format)
format
- the format to usepublic char getDelimiter()
public void setDelimiter(char delimiter)
delimiter
- the delimiter to usepublic boolean isParameter(CSVFormat.Parameter p)
p
- the parametertrue
if the parameter is set, false
otherwisepublic void setParameter(CSVFormat.Parameter p, boolean value)
p
- the parametervalue
- the value to setpublic void importGraph(Graph<V,E> graph, Reader input) throws ImportException
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.
importGraph
in interface GraphImporter<V,E>
graph
- the graphinput
- the input readerImportException
- in case an error occurs, such as I/O or parse errorCopyright © 2017. All rights reserved.