use of edu.cmu.tetrad.graph.EdgeListGraphSingleConnections in project tetrad by cmu-phil.
the class JsonUtils method parseJSONObjectToTetradGraph.
public static Graph parseJSONObjectToTetradGraph(JSONObject jObj) {
// Node
List<Node> nodes = parseJSONArrayToTetradNodes(jObj.getJSONArray("nodes"));
EdgeListGraphSingleConnections graph = new EdgeListGraphSingleConnections(nodes);
// Edge
Set<Edge> edges = parseJSONArrayToTetradEdges(graph, jObj.getJSONArray("edgesSet"));
for (Edge edge : edges) {
graph.addEdge(edge);
}
// ambiguousTriples
Set<Triple> ambiguousTriples = parseJSONArrayToTetradTriples(jObj.getJSONArray("ambiguousTriples"));
for (Triple triple : ambiguousTriples) {
graph.addAmbiguousTriple(triple.getX(), triple.getY(), triple.getZ());
}
// underLineTriples
Set<Triple> underLineTriples = parseJSONArrayToTetradTriples(jObj.getJSONArray("underLineTriples"));
for (Triple triple : underLineTriples) {
graph.addUnderlineTriple(triple.getX(), triple.getY(), triple.getZ());
}
// dottedUnderLineTriples
Set<Triple> dottedUnderLineTriples = parseJSONArrayToTetradTriples(jObj.getJSONArray("dottedUnderLineTriples"));
for (Triple triple : dottedUnderLineTriples) {
graph.addDottedUnderlineTriple(triple.getX(), triple.getY(), triple.getZ());
}
// stuffRemovedSinceLastTripleAccess
boolean stuffRemovedSinceLastTripleAccess = jObj.getBoolean("stuffRemovedSinceLastTripleAccess");
graph.setStuffRemovedSinceLastTripleAccess(stuffRemovedSinceLastTripleAccess);
// highlightedEdges
Set<Edge> highlightedEdges = parseJSONArrayToTetradEdges(graph, jObj.getJSONArray("highlightedEdges"));
for (Edge edge : highlightedEdges) {
graph.setHighlighted(edge, true);
}
return graph;
}
use of edu.cmu.tetrad.graph.EdgeListGraphSingleConnections in project tetrad by cmu-phil.
the class MagToPag method convert.
public Graph convert() {
logger.log("info", "Starting DAG to PAG_of_the_true_DAG.");
setMaxPathLength(maxPathLength);
Graph graph = new EdgeListGraphSingleConnections(mag);
graph.reorientAllWith(Endpoint.CIRCLE);
FciOrient fciOrient = new FciOrient(new DagSepsets(mag));
fciOrient.setCompleteRuleSetUsed(completeRuleSetUsed);
return fciOrient.orient(graph);
}