V
- the graph vertex typeE
- the graph edge typepublic class CSVExporter<V,E> extends Object implements GraphExporter<V,E>
The exporter supports three 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 exporter can be adjusted using the
setParameter
method. See
CSVFormat
for a description of the formats.
The default output 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 escaped using the new separator. See Delimiter- separated values for more information.
CSVFormat
Constructor and Description |
---|
CSVExporter()
Creates a new CSVExporter with
CSVFormat.ADJACENCY_LIST format and integer name
provider for the vertices. |
CSVExporter(CSVFormat format)
Creates a new CSVExporter with integer name providers for the vertices.
|
CSVExporter(CSVFormat format,
char delimiter)
Creates a new CSVExporter with integer name providers for the vertices.
|
CSVExporter(VertexNameProvider<V> vertexIDProvider,
CSVFormat format,
char delimiter)
Constructs a new CSVExporter with the given ID providers and format.
|
Modifier and Type | Method and Description |
---|---|
void |
exportGraph(Graph<V,E> g,
Writer writer)
Exports a graph
|
char |
getDelimiter()
Get the delimiter (comma, semicolon, pipe, etc).
|
CSVFormat |
getFormat()
Get the format of the exporter
|
boolean |
isParameter(CSVFormat.Parameter p)
Return if a particular parameter of the exporter is enabled
|
void |
setDelimiter(char delimiter)
Set the delimiter (comma, semicolon, pipe, etc).
|
void |
setFormat(CSVFormat format)
Set the format of the exporter
|
void |
setParameter(CSVFormat.Parameter p,
boolean value)
Set the value of a parameter of the exporter
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exportGraph, exportGraph
public CSVExporter()
CSVFormat.ADJACENCY_LIST
format and integer name
provider for the vertices.public CSVExporter(CSVFormat format)
format
- the format to usepublic CSVExporter(CSVFormat format, char delimiter)
format
- the format to usedelimiter
- delimiter to usepublic CSVExporter(VertexNameProvider<V> vertexIDProvider, CSVFormat format, char delimiter)
vertexIDProvider
- for generating vertex IDs. Must not be null.format
- the format to usedelimiter
- delimiter to usepublic void exportGraph(Graph<V,E> g, Writer writer)
exportGraph
in interface GraphExporter<V,E>
g
- the graphwriter
- the writerpublic 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 CSVFormat getFormat()
public void setFormat(CSVFormat format)
format
- the format to usepublic char getDelimiter()
public void setDelimiter(char delimiter)
delimiter
- the delimiter to useCopyright © 2016. All rights reserved.