edu.uci.ics.jung.io
Class GraphMLWriter<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.io.GraphMLWriter<V,E>

public class GraphMLWriter<V,E>
extends Object

Writes graphs out in GraphML format. Current known issues:


Field Summary
protected  boolean directed
           
protected  Map<String,GraphMLMetadata<E>> edge_data
           
protected  org.apache.commons.collections15.Transformer<E,String> edge_desc
           
protected  org.apache.commons.collections15.Transformer<E,String> edge_ids
           
protected  Map<String,GraphMLMetadata<Hypergraph<V,E>>> graph_data
           
protected  org.apache.commons.collections15.Transformer<Hypergraph<V,E>,String> graph_desc
           
protected  int nest_level
           
protected  Map<String,GraphMLMetadata<V>> vertex_data
           
protected  org.apache.commons.collections15.Transformer<V,String> vertex_desc
           
protected  org.apache.commons.collections15.Transformer<V,String> vertex_ids
           
 
Constructor Summary
GraphMLWriter()
           
 
Method Summary
 void addEdgeData(String id, String description, String default_value, org.apache.commons.collections15.Transformer<E,String> edge_transformer)
          Adds a new edge data specification.
 void addGraphData(String id, String description, String default_value, org.apache.commons.collections15.Transformer<Hypergraph<V,E>,String> graph_transformer)
          Adds a new graph data specification.
 void addVertexData(String id, String description, String default_value, org.apache.commons.collections15.Transformer<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)
           
 void setEdgeData(Map<String,GraphMLMetadata<E>> edge_map)
          Provides a map from data type name to edge data.
 void setEdgeDescriptions(org.apache.commons.collections15.Transformer<E,String> edge_desc)
          Provides edge descriptions.
 void setEdgeIDs(org.apache.commons.collections15.Transformer<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(org.apache.commons.collections15.Transformer<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(org.apache.commons.collections15.Transformer<V,String> vertex_desc)
          Provides vertex descriptions.
 void setVertexIDs(org.apache.commons.collections15.Transformer<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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vertex_ids

protected org.apache.commons.collections15.Transformer<V,String> vertex_ids

edge_ids

protected org.apache.commons.collections15.Transformer<E,String> edge_ids

graph_data

protected Map<String,GraphMLMetadata<Hypergraph<V,E>>> graph_data

vertex_data

protected Map<String,GraphMLMetadata<V>> vertex_data

edge_data

protected Map<String,GraphMLMetadata<E>> edge_data

vertex_desc

protected org.apache.commons.collections15.Transformer<V,String> vertex_desc

edge_desc

protected org.apache.commons.collections15.Transformer<E,String> edge_desc

graph_desc

protected org.apache.commons.collections15.Transformer<Hypergraph<V,E>,String> graph_desc

directed

protected boolean directed

nest_level

protected int nest_level
Constructor Detail

GraphMLWriter

public GraphMLWriter()
Method Detail

save

public void save(Hypergraph<V,E> graph,
                 Writer w)
          throws IOException
Parameters:
graph -
w -
Throws:
IOException

writeIndentedText

protected void writeIndentedText(BufferedWriter w,
                                 String to_write)
                          throws IOException
Throws:
IOException

writeVertexData

protected void writeVertexData(Hypergraph<V,E> graph,
                               BufferedWriter w)
                        throws IOException
Throws:
IOException

writeEdgeData

protected void writeEdgeData(Hypergraph<V,E> g,
                             Writer w)
                      throws IOException
Throws:
IOException

writeKeySpecification

protected void writeKeySpecification(String key,
                                     String type,
                                     GraphMLMetadata<?> ds,
                                     BufferedWriter bw)
                              throws IOException
Throws:
IOException

format

protected String format(String type,
                        String attr,
                        String value,
                        String contents)

setVertexIDs

public void setVertexIDs(org.apache.commons.collections15.Transformer<V,String> vertex_ids)
Provides an ID that will be used to identify a vertex in the output file. If the vertex IDs are not set, the ID for each vertex will default to the output of toString (and thus not guaranteed to be unique).

Parameters:
vertex_ids -

setEdgeIDs

public void setEdgeIDs(org.apache.commons.collections15.Transformer<E,String> edge_ids)
Provides an ID that will be used to identify an edge in the output file. If any edge ID is missing, no ID will be written out for the corresponding edge.

Parameters:
edge_ids -

setGraphData

public void setGraphData(Map<String,GraphMLMetadata<Hypergraph<V,E>>> graph_map)
Provides a map from data type name to graph data.


setVertexData

public void setVertexData(Map<String,GraphMLMetadata<V>> vertex_map)
Provides a map from data type name to vertex data.


setEdgeData

public void setEdgeData(Map<String,GraphMLMetadata<E>> edge_map)
Provides a map from data type name to edge data.


addGraphData

public void addGraphData(String id,
                         String description,
                         String default_value,
                         org.apache.commons.collections15.Transformer<Hypergraph<V,E>,String> graph_transformer)
Adds a new graph data specification.


addVertexData

public void addVertexData(String id,
                          String description,
                          String default_value,
                          org.apache.commons.collections15.Transformer<V,String> vertex_transformer)
Adds a new vertex data specification.


addEdgeData

public void addEdgeData(String id,
                        String description,
                        String default_value,
                        org.apache.commons.collections15.Transformer<E,String> edge_transformer)
Adds a new edge data specification.


setVertexDescriptions

public void setVertexDescriptions(org.apache.commons.collections15.Transformer<V,String> vertex_desc)
Provides vertex descriptions.


setEdgeDescriptions

public void setEdgeDescriptions(org.apache.commons.collections15.Transformer<E,String> edge_desc)
Provides edge descriptions.


setGraphDescriptions

public void setGraphDescriptions(org.apache.commons.collections15.Transformer<Hypergraph<V,E>,String> graph_desc)
Provides graph descriptions.



Copyright © 2009. All Rights Reserved.