public class GraphMLWriter<V,E> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
directed |
protected Map<String,GraphMLMetadata<E>> |
edge_data |
protected com.google.common.base.Function<? super E,String> |
edge_desc |
protected com.google.common.base.Function<? super E,String> |
edge_ids |
protected Map<String,GraphMLMetadata<Hypergraph<V,E>>> |
graph_data |
protected com.google.common.base.Function<? super Hypergraph<V,E>,String> |
graph_desc |
protected int |
nest_level |
protected Map<String,GraphMLMetadata<V>> |
vertex_data |
protected com.google.common.base.Function<? super V,String> |
vertex_desc |
protected com.google.common.base.Function<? super V,String> |
vertex_ids |
| Constructor and Description |
|---|
GraphMLWriter() |
| Modifier and Type | Method and Description |
|---|---|
void |
addEdgeData(String id,
String description,
String default_value,
com.google.common.base.Function<E,String> edge_transformer)
Adds a new edge data specification.
|
void |
addGraphData(String id,
String description,
String default_value,
com.google.common.base.Function<Hypergraph<V,E>,String> graph_transformer)
Adds a new graph data specification.
|
void |
addVertexData(String id,
String description,
String default_value,
com.google.common.base.Function<V,String> vertex_transformer)
Adds a new vertex data specification.
|
protected String |
format(String type,
String attr,
String value,
String contents) |
void |
save(Hypergraph<V,E> graph,
Writer w)
Writes
graph out using w. |
void |
setEdgeData(Map<String,GraphMLMetadata<E>> edge_map)
Provides a map from data type name to edge data.
|
void |
setEdgeDescriptions(com.google.common.base.Function<E,String> edge_desc)
Provides edge descriptions.
|
void |
setEdgeIDs(com.google.common.base.Function<E,String> edge_ids)
Provides an ID that will be used to identify an edge in the output file.
|
void |
setGraphData(Map<String,GraphMLMetadata<Hypergraph<V,E>>> graph_map)
Provides a map from data type name to graph data.
|
void |
setGraphDescriptions(com.google.common.base.Function<Hypergraph<V,E>,String> graph_desc)
Provides graph descriptions.
|
void |
setVertexData(Map<String,GraphMLMetadata<V>> vertex_map)
Provides a map from data type name to vertex data.
|
void |
setVertexDescriptions(com.google.common.base.Function<V,String> vertex_desc)
Provides vertex descriptions.
|
void |
setVertexIDs(com.google.common.base.Function<V,String> vertex_ids)
Provides an ID that will be used to identify a vertex in the output file.
|
protected void |
writeEdgeData(Hypergraph<V,E> g,
Writer w) |
protected void |
writeIndentedText(BufferedWriter w,
String to_write) |
protected void |
writeKeySpecification(String key,
String type,
GraphMLMetadata<?> ds,
BufferedWriter bw) |
protected void |
writeVertexData(Hypergraph<V,E> graph,
BufferedWriter w) |
protected Map<String,GraphMLMetadata<Hypergraph<V,E>>> graph_data
protected Map<String,GraphMLMetadata<V>> vertex_data
protected Map<String,GraphMLMetadata<E>> edge_data
protected com.google.common.base.Function<? super Hypergraph<V,E>,String> graph_desc
protected boolean directed
protected int nest_level
public void save(Hypergraph<V,E> graph, Writer w) throws IOException
graph out using w.graph - the graph to write outw - the writer instance to which the graph data will be written outIOException - if writing the graph failsprotected void writeIndentedText(BufferedWriter w, String to_write) throws IOException
IOExceptionprotected void writeVertexData(Hypergraph<V,E> graph, BufferedWriter w) throws IOException
IOExceptionprotected void writeEdgeData(Hypergraph<V,E> g, Writer w) throws IOException
IOExceptionprotected void writeKeySpecification(String key, String type, GraphMLMetadata<?> ds, BufferedWriter bw) throws IOException
IOExceptionpublic void setVertexIDs(com.google.common.base.Function<V,String> vertex_ids)
toString
(and thus not guaranteed to be unique).vertex_ids - a mapping from vertex to IDpublic void setEdgeIDs(com.google.common.base.Function<E,String> edge_ids)
edge_ids - a mapping from edge to IDpublic void setGraphData(Map<String,GraphMLMetadata<Hypergraph<V,E>>> graph_map)
graph_map - map from data type name to graph datapublic void setVertexData(Map<String,GraphMLMetadata<V>> vertex_map)
vertex_map - map from data type name to vertex datapublic void setEdgeData(Map<String,GraphMLMetadata<E>> edge_map)
edge_map - map from data type name to edge datapublic void addGraphData(String id, String description, String default_value, com.google.common.base.Function<Hypergraph<V,E>,String> graph_transformer)
id - the ID of the data to adddescription - a description of the data to adddefault_value - a default value for the data typegraph_transformer - a mapping from graphs to their string representationspublic void addVertexData(String id, String description, String default_value, com.google.common.base.Function<V,String> vertex_transformer)
id - the ID of the data to adddescription - a description of the data to adddefault_value - a default value for the data typevertex_transformer - a mapping from vertices to their string representationspublic void addEdgeData(String id, String description, String default_value, com.google.common.base.Function<E,String> edge_transformer)
id - the ID of the data to adddescription - a description of the data to adddefault_value - a default value for the data typeedge_transformer - a mapping from edges to their string representationspublic void setVertexDescriptions(com.google.common.base.Function<V,String> vertex_desc)
vertex_desc - a mapping from vertices to their descriptionspublic void setEdgeDescriptions(com.google.common.base.Function<E,String> edge_desc)
edge_desc - a mapping from edges to their descriptionspublic void setGraphDescriptions(com.google.common.base.Function<Hypergraph<V,E>,String> graph_desc)
graph_desc - a mapping from graphs to their descriptionsCopyright © 2016. All rights reserved.