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:
java.lang.Iterable<T>
,Graph<T>
public class SimpleGraph<T extends Node> extends DefaultGraph<T> implements 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
Constructors Constructor Description SimpleGraph()
create a new SimpleGraph instanceSimpleGraph(Graph<T> graph)
create a copy of the given graph
-
Method Summary
Modifier and Type Method Description boolean
addAll(java.util.Collection<? extends T> c)
add all nodes to the graphboolean
addAllEdges(java.util.Collection<Edge<T>> c)
add all edges to the graphboolean
areDisconnected(java.util.Collection<? extends T> nodesA, java.util.Collection<? extends T> nodesB)
Compute whether nodesA and nodesB are disconnected and thus d-separated in the graphboolean
remove(Edge<T> edge)
remove the given edge from the graphboolean
remove(T node)
remove the given node from the graphSimpleGraph<T>
toUndirectedGraph()
convert the graph into a undirected graph-
Methods inherited from class org.tweetyproject.graphs.DefaultGraph
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, 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.Graph
add, add, areAdjacent, contains, existsDirectedPath, getAdjacencyMatrix, getChildren, getComplementGraph, getEdge, getEdges, getNeighbors, getNodes, getNumberOfNodes, getParents, getRestriction, getStronglyConnectedComponents, getSubgraphs, hasSelfLoops, isWeightedGraph, iterator, toString
-
-
-
-
Method Detail
-
addAll
public boolean addAll(java.util.Collection<? extends T> c)
add all nodes to the graph- Parameters:
c
- a collection of nodes- Returns:
- true iff all nodes are added
-
addAllEdges
public boolean addAllEdges(java.util.Collection<Edge<T>> c)
add all edges to the graph- Parameters:
c
- a collection of edges- Returns:
- true iff all edges are added
-
remove
public boolean remove(T node)
remove the given node from the graph- Parameters:
node
- some node- Returns:
- true iff the structure has been changed
-
remove
public boolean remove(Edge<T> edge)
remove the given edge from the graph- Parameters:
edge
- some edge- Returns:
- true iff the structure has changed
-
areDisconnected
public boolean areDisconnected(java.util.Collection<? extends T> nodesA, java.util.Collection<? extends T> nodesB)
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
public SimpleGraph<T> toUndirectedGraph()
convert the graph into a undirected graph- Returns:
- the undirected graph
-
-