Package org.tweetyproject.graphs
Class SimpleGraph<T extends Node>
java.lang.Object
org.tweetyproject.graphs.DefaultGraph<T>
org.tweetyproject.graphs.SimpleGraph<T>
- Type Parameters:
T
- the type of the node
- All Implemented Interfaces:
Iterable<T>
,GeneralGraph<T>
,Graph<T>
An extended version of the DefaultGraph which supports removing of nodes as well as
some utility functions for d-separation
- Author:
- Lars Bengel
-
Field Summary
Fields inherited from interface org.tweetyproject.graphs.Graph
IGNORE_SELFLOOPS, INVERT_SELFLOOPS, REMOVE_SELFLOOPS
-
Constructor Summary
ConstructorDescriptioncreate a new SimpleGraph instanceSimpleGraph
(Graph<T> graph) create a copy of the given graph -
Method Summary
Modifier and TypeMethodDescriptionboolean
addAll
(Collection<? extends T> c) add all nodes to the graphboolean
addAllEdges
(Collection<Edge<T>> c) add all edges to the graphboolean
addSubGraph
(T superExit, SimpleGraph<T> subGraph, T subEntry, String label) Adds a graph as a subgraphboolean
areDisconnected
(Collection<? extends T> nodesA, Collection<? extends T> nodesB) Compute whether nodesA and nodesB are disconnected and thus d-separated in the graphboolean
remove the given edge from the graphboolean
remove the given node from the graphconvert the graph into a undirected graphMethods inherited from class org.tweetyproject.graphs.DefaultGraph
add, add, add, areAdjacent, contains, containsBackEdge, containsCycle, existsDirectedPath, existsDirectedPath, getAdjacencyMatrix, getChildren, getComplementGraph, getComponents, getCyclesExcludingSelfLoops, getCyclesIncludingSelfLoops, getEdge, getEdges, getInducedSubgraphs, getNeighbors, getNodes, getNumberOfNodes, getParents, getRestriction, getStronglyConnectedComponents, getStronglyConnectedComponents, getSubgraphs, getSubgraphs, hasSelfLoops, isBipartite, isWeightedGraph, iterator, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tweetyproject.graphs.GeneralGraph
getRestriction
Methods inherited from interface org.tweetyproject.graphs.Graph
add, add, areAdjacent, contains, existsDirectedPath, getAdjacencyMatrix, getChildren, getComplementGraph, getEdge, getEdges, getNeighbors, getNodes, getNumberOfNodes, getParents, getStronglyConnectedComponents, getSubgraphs, hasSelfLoops, isWeightedGraph, iterator, toString
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SimpleGraph
create a copy of the given graph- Parameters:
graph
- some graph
-
SimpleGraph
public SimpleGraph()create a new SimpleGraph instance
-
-
Method Details
-
addAll
add all nodes to the graph- Parameters:
c
- a collection of nodes- Returns:
- true iff all nodes are added
-
addAllEdges
add all edges to the graph- Parameters:
c
- a collection of edges- Returns:
- true iff all edges are added
-
remove
remove the given node from the graph- Parameters:
node
- some node- Returns:
- true iff the structure has been changed
-
remove
remove the given edge from the graph- Parameters:
edge
- some edge- Returns:
- true iff the structure has changed
-
areDisconnected
Compute whether nodesA and nodesB are disconnected and thus d-separated in the graph- Parameters:
nodesA
- a set of argumentsnodesB
- a set of arguments- Returns:
- true iff argsA and argsB are disconnected in the graph
-
toUndirectedGraph
convert the graph into a undirected graph- Returns:
- the undirected graph
-
addSubGraph
public boolean addSubGraph(T superExit, SimpleGraph<T> subGraph, T subEntry, String label) throws NoSuchObjectException Adds a graph as a subgraph- Parameters:
superExit
- Node of the this graph, under which the new graph will be anchoredsubGraph
- Graph, which will be added to the super-graphsubEntry
- Node of the subgraph, which will be connected to the super-graphlabel
- Label of the newly created edge, from the superExit node to the subRoot node- Throws:
NoSuchObjectException
- Thrown if superExit is not a node of this graph
-