Class GraphSaveLoadUtils

java.lang.Object
edu.cmu.tetrad.graph.GraphSaveLoadUtils

public class GraphSaveLoadUtils extends Object
Methods to load or save graphs.
Author:
josephramsey
  • Constructor Details

    • GraphSaveLoadUtils

      public GraphSaveLoadUtils()
  • Method Details

    • loadGraph

      public static Graph loadGraph(File file)
    • loadGraphTxt

      public static Graph loadGraphTxt(File file)
    • loadGraphRuben

      public static Graph loadGraphRuben(File file)
    • loadGraphJson

      public static Graph loadGraphJson(File file)
    • loadGraphBNTPcMatrix

      public static Graph loadGraphBNTPcMatrix(List<Node> vars, DataSet dataSet)
    • graphRMatrixTxt

      public static String graphRMatrixTxt(Graph graph) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • loadRSpecial

      public static Graph loadRSpecial(File file)
    • loadGraphPcalg

      public static Graph loadGraphPcalg(File file)
    • loadGraphRMatrix

      public static String loadGraphRMatrix(Graph graph) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • readerToGraphTxt

      public static Graph readerToGraphTxt(String graphString) throws IOException
      Throws:
      IOException
    • readerToGraphTxt

      public static Graph readerToGraphTxt(Reader reader) throws IOException
      Throws:
      IOException
    • saveGraph

      public static PrintWriter saveGraph(Graph graph, File file, boolean xml)
      Parameters:
      graph - The graph to be saved.
      file - The file to save it in.
      xml - True if to be saved in XML, false if in text.
      Returns:
      I have no idea whey I'm returning this; it's already closed...
    • readerToGraphRuben

      public static Graph readerToGraphRuben(Reader reader) throws IOException
      Throws:
      IOException
    • readerToGraphJson

      public static Graph readerToGraphJson(Reader reader) throws IOException
      Throws:
      IOException
    • graphToDot

      public static String graphToDot(Graph graph)
      Converts a graph to a Graphviz .dot file
    • graphToDot

      public static void graphToDot(Graph graph, File file)
    • convertToXml

      public static nu.xom.Element convertToXml(Graph graph)
      Returns:
      an XML element representing the given graph. (Well, only a basic graph for now...)
    • graphToXml

      public static String graphToXml(Graph graph)
    • graphToLavaan

      public static String graphToLavaan(Graph g)
    • graphToPcalg

      public static String graphToPcalg(Graph g)
    • parseGraphXml

      public static Graph parseGraphXml(nu.xom.Element graphElement, Map<String,Node> nodes) throws nu.xom.ParsingException
      Throws:
      nu.xom.ParsingException
    • getRootElement

      public static nu.xom.Element getRootElement(File file) throws nu.xom.ParsingException, IOException
      Throws:
      nu.xom.ParsingException
      IOException
    • grabLayout

      public static HashMap<String,PointXy> grabLayout(List<Node> nodes)
    • getCollidersFromGraph

      public static List<Triple> getCollidersFromGraph(Node node, Graph graph)
      Returns:
      A list of triples of the form X*->Y<-*Z.