public class BIFParser extends Object implements GraphConstants
DIRECTED, DOUBLE, NORMAL, PLURAL_DUMMY, REVERSED, SINGULAR_DUMMY
Constructor and Description |
---|
BIFParser(InputStream instream,
FastVector nodes,
FastVector edges)
Constructor (if our input is an InputStream)
|
BIFParser(String input,
FastVector nodes,
FastVector edges)
Constructor (if our input is a String)
|
Modifier and Type | Method and Description |
---|---|
String |
parse()
This method parses the string or the InputStream that we
passed in through the constructor and builds up the
m_nodes and m_edges vectors
|
static void |
writeXMLBIF03(String filename,
String graphName,
FastVector nodes,
FastVector edges)
This method writes a graph in XMLBIF ver.
|
public BIFParser(String input, FastVector nodes, FastVector edges)
input
- the string to be parsed (should not be null)nodes
- vector containing GraphNode objects (should be empty)edges
- vector containing GraphEdge objects (should be empty)public BIFParser(InputStream instream, FastVector nodes, FastVector edges)
instream
- the InputStream to be parsed (should not be null)nodes
- vector containing GraphNode objects (should be empty)edges
- vector containing GraphEdge objects (should be empty)public String parse() throws Exception
Exception
- if both the inString and inStream are
null, i.e. no input has been providedBIFFormatException
- if there is format of the
input is not correct. The format should conform to
XMLBIF version 0.3NumberFormatException
- if there is an invalid
char in the probability table of a node.public static void writeXMLBIF03(String filename, String graphName, FastVector nodes, FastVector edges)
filename
- The name of the file to write in. (will overwrite)graphName
- The name of the graph. (will be the name of network
tag in XMLBIF)nodes
- Vector containing all the nodesedges
- Vector containing all the edgesCopyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.