Package com.semedy.reasoner.utils
Class Graph<E extends Node>
java.lang.Object
com.semedy.reasoner.utils.Graph<E>
- Type Parameters:
E
- , the type of nodes
- All Implemented Interfaces:
Iterable<E>
data structure for a graph
- Author:
- angele
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Add a new node to graphvoid
clear()
remove all nodes from graphget a dense graph, i.e. a strong component is one node containing the original nodesgetNodes()
get the nodes of the graphcreate a list of strong components of the graphgetSubGraph
(List<E> subgraphnodes) create a sub-graph from all nodes starting at subgraphnodesiterator()
Iterating over all nodes of the graphboolean
removeNode
(Node n) remove a node from graphMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Graph
public Graph()
-
-
Method Details
-
iterator
Iterating over all nodes of the graph -
addNode
Add a new node to graph- Parameters:
n
- , node to add- Returns:
-
removeNode
remove a node from graph- Parameters:
n
- , node to be removed- Returns:
-
clear
public void clear()remove all nodes from graph -
getSubGraph
create a sub-graph from all nodes starting at subgraphnodes- Parameters:
subgraphnodes
- , list of nodes to start from- Returns:
- sub-graph
-
getStrongComponents
create a list of strong components of the graph- Returns:
-
getDenseGraph
get a dense graph, i.e. a strong component is one node containing the original nodes- Returns:
-
getNodes
get the nodes of the graph- Returns:
-