Package org.jgrapht.io
Class JSONExporter<V,E>
- java.lang.Object
-
- org.jgrapht.io.JSONExporter<V,E>
-
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
GraphExporter<V,E>
@Deprecated public class JSONExporter<V,E> extends Object implements GraphExporter<V,E>
Deprecated.UseJSONExporter
instead.Exports a graph using JSON.The output is one object which contains:
- A member named
nodes
whose value is an array of nodes. - A member named
edges
whose value is an array of edges. - Two members named
creator
andversion
for metadata.
Each node contains an identifier and possibly other attributes provided using a
ComponentAttributeProvider
. Similarly each edge contains the source and target vertices, a possible identifier usingComponentNameProvider
and possible other attributes using aComponentAttributeProvider
. All these can be adjusted using the appropriate constructor call, seeJSONExporter(ComponentNameProvider, ComponentAttributeProvider, ComponentNameProvider, ComponentAttributeProvider)
. The default constructor constructs integer identifiers using anIntegerComponentNameProvider
for both vertices and edges and does not output any custom attributes usingEmptyComponentAttributeProvider
.- Author:
- Dimitrios Michail
-
-
Field Summary
Fields Modifier and Type Field Description protected ComponentNameProvider<E>
edgeIDProvider
Deprecated.Provides an identifier for an edge.protected ComponentNameProvider<V>
vertexIDProvider
Deprecated.Provides an identifier for a vertex.
-
Constructor Summary
Constructors Constructor Description JSONExporter()
Deprecated.Creates a new exporter with integer name provider for the vertex identifiers.JSONExporter(ComponentNameProvider<V> vertexIDProvider)
Deprecated.Creates a new exporter.JSONExporter(ComponentNameProvider<V> vertexIDProvider, ComponentAttributeProvider<V> vertexAttributeProvider, ComponentNameProvider<E> edgeIDProvider, ComponentAttributeProvider<E> edgeAttributeProvider)
Deprecated.Constructs a new exporter
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
exportGraph(Graph<V,E> g, Writer writer)
Deprecated.Export a graphComponentNameProvider<E>
getEdgeIDProvider()
Deprecated.Get the edge id providerComponentNameProvider<V>
getVertexIDProvider()
Deprecated.Get the vertex id providervoid
setEdgeIDProvider(ComponentNameProvider<E> edgeIDProvider)
Deprecated.Set the edge id provider.void
setVertexIDProvider(ComponentNameProvider<V> vertexIDProvider)
Deprecated.Set the vertex id provider-
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.GraphExporter
exportGraph, exportGraph
-
-
-
-
Field Detail
-
vertexIDProvider
protected ComponentNameProvider<V> vertexIDProvider
Deprecated.Provides an identifier for a vertex.
-
edgeIDProvider
protected ComponentNameProvider<E> edgeIDProvider
Deprecated.Provides an identifier for an edge.
-
-
Constructor Detail
-
JSONExporter
public JSONExporter()
Deprecated.Creates a new exporter with integer name provider for the vertex identifiers.
-
JSONExporter
public JSONExporter(ComponentNameProvider<V> vertexIDProvider)
Deprecated.Creates a new exporter.- Parameters:
vertexIDProvider
- for generating vertex identifiers. Must not be null.
-
JSONExporter
public JSONExporter(ComponentNameProvider<V> vertexIDProvider, ComponentAttributeProvider<V> vertexAttributeProvider, ComponentNameProvider<E> edgeIDProvider, ComponentAttributeProvider<E> edgeAttributeProvider)
Deprecated.Constructs a new exporter- Parameters:
vertexIDProvider
- for generating vertex identifiers. Must not be null.vertexAttributeProvider
- for generating vertex attributes. If null, no additional attributes will be exported.edgeIDProvider
- for generating edge identifiers. Must not be null.edgeAttributeProvider
- for generating edge attributes. If null, no additional attributes will be exported.
-
-
Method Detail
-
exportGraph
public void exportGraph(Graph<V,E> g, Writer writer) throws ExportException
Deprecated.Description copied from interface:GraphExporter
Export a graph- Specified by:
exportGraph
in interfaceGraphExporter<V,E>
- Parameters:
g
- the graph to exportwriter
- the output writer- Throws:
ExportException
- in case any error occurs
-
getVertexIDProvider
public ComponentNameProvider<V> getVertexIDProvider()
Deprecated.Get the vertex id provider- Returns:
- the vertex id provider
-
setVertexIDProvider
public void setVertexIDProvider(ComponentNameProvider<V> vertexIDProvider)
Deprecated.Set the vertex id provider- Parameters:
vertexIDProvider
- the new vertex id provider. Must not be null.
-
getEdgeIDProvider
public ComponentNameProvider<E> getEdgeIDProvider()
Deprecated.Get the edge id provider- Returns:
- The edge provider
-
setEdgeIDProvider
public void setEdgeIDProvider(ComponentNameProvider<E> edgeIDProvider)
Deprecated.Set the edge id provider.- Parameters:
edgeIDProvider
- the new edge id provider. Must not be null.
-
-