public class BIFParser extends java.lang.Object implements GraphConstants
DIRECTED, DOUBLE, NORMAL, PLURAL_DUMMY, REVERSED, SINGULAR_DUMMY
Constructor and Description |
---|
BIFParser(java.io.InputStream instream,
java.util.ArrayList<GraphNode> nodes,
java.util.ArrayList<GraphEdge> edges)
Constructor (if our input is an InputStream)
|
BIFParser(java.lang.String input,
java.util.ArrayList<GraphNode> nodes,
java.util.ArrayList<GraphEdge> edges)
Constructor (if our input is a String)
|
Modifier and Type | Method and Description |
---|---|
java.lang.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(java.lang.String filename,
java.lang.String graphName,
java.util.ArrayList<GraphNode> nodes,
java.util.ArrayList<GraphEdge> edges)
This method writes a graph in XMLBIF ver.
|
public BIFParser(java.lang.String input, java.util.ArrayList<GraphNode> nodes, java.util.ArrayList<GraphEdge> 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(java.io.InputStream instream, java.util.ArrayList<GraphNode> nodes, java.util.ArrayList<GraphEdge> 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 java.lang.String parse() throws java.lang.Exception
java.lang.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.3java.lang.NumberFormatException
- if there is an invalid char in the
probability table of a node.public static void writeXMLBIF03(java.lang.String filename, java.lang.String graphName, java.util.ArrayList<GraphNode> nodes, java.util.ArrayList<GraphEdge> 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 edges