public class GmlExporter<V,E> extends Object
For a description of the format see http://www.infosun.fmi.uni-passau.de/Graphlet/GML/.
The objects associated with vertices and edges are exported as labels
using their toString() implementation. See the setPrintLabels(Integer)
method. The default behavior is to export no label
information.
Modifier and Type | Field and Description |
---|---|
static Integer |
PRINT_EDGE_LABELS
Option to export only the edge labels.
|
static Integer |
PRINT_EDGE_VERTEX_LABELS
Option to export both edge and vertex labels.
|
static Integer |
PRINT_NO_LABELS
Option to export no vertex or edge labels.
|
static Integer |
PRINT_VERTEX_LABELS
Option to export only the vertex labels.
|
Constructor and Description |
---|
GmlExporter()
Creates a new GmlExporter object with integer name providers for the
vertex and edge IDs and null providers for the vertex and edge labels.
|
GmlExporter(VertexNameProvider<V> vertexIDProvider,
VertexNameProvider<V> vertexLabelProvider,
EdgeNameProvider<E> edgeIDProvider,
EdgeNameProvider<E> edgeLabelProvider)
Constructs a new GmlExporter object with the given ID and label
providers.
|
Modifier and Type | Method and Description |
---|---|
void |
export(Writer output,
DirectedGraph<V,E> g)
Exports a directed graph into a plain text file in GML format.
|
void |
export(Writer output,
UndirectedGraph<V,E> g)
Exports an undirected graph into a plain text file in GML format.
|
Integer |
getPrintLabels()
Get whether to export the vertex and edge labels.
|
void |
setPrintLabels(Integer i)
Set whether to export the vertex and edge labels.
|
public static final Integer PRINT_NO_LABELS
public static final Integer PRINT_EDGE_LABELS
public static final Integer PRINT_EDGE_VERTEX_LABELS
public static final Integer PRINT_VERTEX_LABELS
public GmlExporter()
public GmlExporter(VertexNameProvider<V> vertexIDProvider, VertexNameProvider<V> vertexLabelProvider, EdgeNameProvider<E> edgeIDProvider, EdgeNameProvider<E> edgeLabelProvider)
vertexIDProvider
- for generating vertex IDs. Must not be null.vertexLabelProvider
- for generating vertex labels. If null, vertex
labels will be generated using the toString() method of the vertex
object.edgeIDProvider
- for generating vertex IDs. Must not be null.edgeLabelProvider
- for generating edge labels. If null, edge labels
will be generated using the toString() method of the edge object.public void export(Writer output, UndirectedGraph<V,E> g)
output
- the writer to which the graph to be exportedg
- the undirected graph to be exportedpublic void export(Writer output, DirectedGraph<V,E> g)
output
- the writer to which the graph to be exportedg
- the directed graph to be exportedpublic void setPrintLabels(Integer i)
i
- What labels to export. Valid options are PRINT_NO_LABELS
, PRINT_EDGE_LABELS
, PRINT_EDGE_VERTEX_LABELS
, and PRINT_VERTEX_LABELS
.IllegalArgumentException
- if a non-supported value is usedPRINT_NO_LABELS
,
PRINT_EDGE_LABELS
,
PRINT_EDGE_VERTEX_LABELS
,
PRINT_VERTEX_LABELS
public Integer getPrintLabels()
PRINT_NO_LABELS
, PRINT_EDGE_LABELS
,
PRINT_EDGE_VERTEX_LABELS
, or PRINT_VERTEX_LABELS
.Copyright © 2016. All rights reserved.