netkit.graph.io
Class PajekGraph
java.lang.Object
netkit.graph.io.PajekGraph
public class PajekGraph
- extends java.lang.Object
Method Summary |
static Graph |
readGraph(java.io.File pajekFile)
Overloaded entry point for readGraph(Reader) |
static Graph |
readGraph(java.io.Reader pajekReader)
Reads the Graph information from Pajek formatted input,
constructs the data structures and instantiates all of the
instance data. |
static void |
saveGraph(Graph graph,
java.io.PrintWriter pw)
|
static void |
saveGraph(Graph graph,
java.io.PrintWriter pw,
Classification truth,
Estimate pred,
java.lang.String labelAttribute)
|
static void |
saveGraph(Graph graph,
java.lang.String file)
|
static void |
saveGraph(Graph graph,
java.lang.String file,
Classification truth,
Estimate pred,
java.lang.String labelAttribute)
Save the given graph as a pajek graph, to the given file, using the classification and estimate and label. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PajekGraph
public PajekGraph()
readGraph
public static Graph readGraph(java.io.File pajekFile)
- Overloaded entry point for
readGraph(Reader)
- Parameters:
pajekFile
- a File containing the Pajek formatted graph data.
- Returns:
- the constructed Graph object.
- Throws:
java.lang.RuntimeException
- if any of the file format constraints
are violated or the files cannot be read.
readGraph
public static Graph readGraph(java.io.Reader pajekReader)
- Reads the Graph information from Pajek formatted input,
constructs the data structures and instantiates all of the
instance data. This method is provided for compatability with
the Pajek file format.
- Parameters:
pajekReader
- a Reader object containing the Pajek formatted graph data.
- Returns:
- the constructed Graph object.
- Throws:
java.lang.RuntimeException
- if any of the file format constraints
are violated or the files cannot be read.
saveGraph
public static void saveGraph(Graph graph,
java.io.PrintWriter pw,
Classification truth,
Estimate pred,
java.lang.String labelAttribute)
saveGraph
public static void saveGraph(Graph graph,
java.io.PrintWriter pw)
saveGraph
public static void saveGraph(Graph graph,
java.lang.String file)
saveGraph
public static void saveGraph(Graph graph,
java.lang.String file,
Classification truth,
Estimate pred,
java.lang.String labelAttribute)
- Save the given graph as a pajek graph, to the given file, using the classification and estimate and label.
The nodes in the Pajek graph will be colored based on the truth and pred input variables. If there is a pred
object, then the inside of the pajek nodes will be colored based on the prediction and the border of the nodes
will be colored based on the truth. If there is no pred object, then the inside of the pajek node will be
colored based on the truth. If an attribute name is provided, then that will be used as the label of the
nodes. If that attribute is not available, then the id of the node is used instead.
- Parameters:
graph
- The NetKit graph to save in Pajek formatfile
- The file to save it totruth
- The true labels of nodes (can be null, otherwise used to color the node)pred
- The predictions of labels of nodes (can be null)labelAttribute
- The name of the attribute to use as the label of the nodes (if null, then the node ID is used).