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

java.lang.Object
  extended by edu.uci.ics.jung.io.GraphMLFile<V,E>
All Implemented Interfaces:
GraphFile<V,E>

Deprecated. As of JUNG 2.0 beta, replaced with GraphMLReader and GraphMLWriter.

public class GraphMLFile<V,E>
extends Object
implements GraphFile<V,E>

A file reader for GraphML files. Currently, there is only support for directed and undirected graphs. The elements , , , and are simply ignored.

What follows are the native GraphML attributes that are recognized:


These attributes are not stored as explicit UserDatum instances. All other attributes are read in and stored as UserDatum String values with the corresponding graph object, i.e. graph, node, or edge.

A sample file looks like this:
<?xml version="1.0" encoding="iso-8859-1" ?>
<?meta name="GENERATOR" content="XML::Smart 1.3.1" ?>
<?meta name="GENERATOR" content="XML::Smart 1.3.1" ?>
<graph edgedefault="directed" year="1983">
<node id="1" name="V1" color="red"/>
<node id="2" name="V2" color="blue"/>
<node id="3" name="V3" color="green"/>
<edge source="1" target="2" day="Monday"/>
<edge source="1" target="3" day="Tuesday"/>
<edge source="2" target="3" day="Friday"/>
</graph>
Note: In this example, year, color, and day are user-defined attributes that get stored in the object's UserData Assuming we have a Graph g created from the above XML file we can print out the days of the week for each node as follows:

 for (Iterator eIt = g.getEdges().iterator(); eIt.hasNext(); ) {
   Edge v = (Edge) eIt.next();
   System.out.println(e.getUserDatum("day");
 }
 

Author:
Scott White, John Yesberg, Tom Nelson - converted to jung2
See Also:
"http://graphml.graphdrawing.org/"

Field Summary
protected  boolean directed
          Deprecated.  
protected  boolean undirected
          Deprecated.  
 
Constructor Summary
GraphMLFile( graphFactory,  vertexFactory,  edgeFactory)
          Deprecated. Default constructor which uses default GraphMLFileHandler to parse the graph
GraphMLFile(GraphMLFileHandler<V,E> handler)
          Deprecated. Constructors which allows a subclass of GraphMLFileHandler to be used to parse the graph
 
Method Summary
 GraphMLFileHandler<V,E> getMFileHandler()
          Deprecated.  
 Graph<V,E> load(InputStream stream)
          Deprecated. generally, InputStreams are less robust than Readers
 Graph<V,E> load(Reader reader)
          Deprecated.  
 Graph<V,E> load(String filename)
          Deprecated. Loads a graph from a GraphML file.
 List<Graph<V,E>> loadGraphCollection(String dirName, FilenameFilter filter)
          Deprecated. Loads in a list of graphs whose corresponding filenames pass the file filter and are located in the specified directory
 void save(Graph<V,E> g, PrintStream out)
          Deprecated.  
 void save(Graph<V,E> g, String filename)
          Deprecated. Save a graph to disk per the appropriate format
 void setGraphMLFileHandler(GraphMLFileHandler<V,E> fileHandler)
          Deprecated. Allows the user to provide his/her own subclassed GraphML file handerl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

directed

protected boolean directed
Deprecated. 

undirected

protected boolean undirected
Deprecated. 
Constructor Detail

GraphMLFile

public GraphMLFile( graphFactory,
                    vertexFactory,
                    edgeFactory)
Deprecated. 
Default constructor which uses default GraphMLFileHandler to parse the graph


GraphMLFile

public GraphMLFile(GraphMLFileHandler<V,E> handler)
Deprecated. 
Constructors which allows a subclass of GraphMLFileHandler to be used to parse the graph

Parameters:
handler - the user-provided GraphML file handler
Method Detail

load

public Graph<V,E> load(String filename)
Deprecated. 
Loads a graph from a GraphML file.

Specified by:
load in interface GraphFile<V,E>
Parameters:
filename - the fully specified file name
Returns:
the constructed graph

load

public Graph<V,E> load(InputStream stream)
Deprecated. generally, InputStreams are less robust than Readers

Loads a graph from a GraphML input stream.

Parameters:
stream - the input stream which contains the GraphML data
Returns:
the constructed graph

load

public Graph<V,E> load(Reader reader)
Deprecated. 

loadGraphCollection

public List<Graph<V,E>> loadGraphCollection(String dirName,
                                            FilenameFilter filter)
Deprecated. 
Loads in a list of graphs whose corresponding filenames pass the file filter and are located in the specified directory

Parameters:
dirName - the directory containing the set of files that are to be screened through the file filter
filter - the file filter
Returns:
a list of graphs

save

public void save(Graph<V,E> g,
                 String filename)
Deprecated. 
Description copied from interface: GraphFile
Save a graph to disk per the appropriate format

Specified by:
save in interface GraphFile<V,E>
Parameters:
g - the location and name of the file
filename - the graph

save

public void save(Graph<V,E> g,
                 PrintStream out)
Deprecated. 

setGraphMLFileHandler

public void setGraphMLFileHandler(GraphMLFileHandler<V,E> fileHandler)
Deprecated. 
Allows the user to provide his/her own subclassed GraphML file handerl

Parameters:
fileHandler -

getMFileHandler

public GraphMLFileHandler<V,E> getMFileHandler()
Deprecated. 
Returns:
the mFileHandler


Copyright © 2008 null. All Rights Reserved.