Package edu.cmu.tetrad.graph
Class GraphFactoryUtil
java.lang.Object
edu.cmu.tetrad.graph.GraphFactoryUtil
Utility class providing factory methods for creating instances of different types of
Graph objects. This class allows for the creation of graphs with specific configurations
or replication policies.
-
Method Summary
Modifier and TypeMethodDescriptionstatic GraphnewGraph(boolean replicating) Creates a new instance of a Graph with the specified replication policy.static GraphCreates a new instance of a Graph based on the given graph.static GraphCreates a new instance of a Graph initialized with the provided list of nodes.
-
Method Details
-
newGraph
Creates a new instance of a Graph with the specified replication policy. The graph is initialized with an empty list of nodes.- Parameters:
replicating- whether the graph should support replication functionality.- Returns:
- a new Graph instance configured according to the replication policy.
-
newGraph
Creates a new instance of a Graph initialized with the provided list of nodes. Depending on the `replicating` flag, the method returns either a replicable graph or a standard edge-list-based graph.- Parameters:
nodes- the list of nodes to initialize the graph withreplicating- whether the graph should support replication functionality- Returns:
- a new Graph instance configured based on the replication policy and node list
-
newGraph
Creates a new instance of a Graph based on the given graph. If the input graph is an instance of ReplicatingGraph, a new ReplicatingGraph is created as a copy of the input graph. Otherwise, a new EdgeListGraph is created initialized with the nodes from the input graph.- Parameters:
graph- the source graph used to create a new graph instance- Returns:
- a new Graph instance, either a ReplicatingGraph or an EdgeListGraph, based on the type of the provided graph
-