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>

public class Graph<E extends Node> extends Object implements Iterable<E>
data structure for a graph
Author:
angele
  • Constructor Details

    • Graph

      public Graph()
  • Method Details

    • iterator

      public Iterator<E> iterator()
      Iterating over all nodes of the graph
      Specified by:
      iterator in interface Iterable<E extends Node>
    • addNode

      public boolean addNode(E n)
      Add a new node to graph
      Parameters:
      n - , node to add
      Returns:
    • removeNode

      public boolean removeNode(Node n)
      remove a node from graph
      Parameters:
      n - , node to be removed
      Returns:
    • clear

      public void clear()
      remove all nodes from graph
    • getSubGraph

      public Graph<E> getSubGraph(List<E> subgraphnodes)
      create a sub-graph from all nodes starting at subgraphnodes
      Parameters:
      subgraphnodes - , list of nodes to start from
      Returns:
      sub-graph
    • getStrongComponents

      public List<List<E>> getStrongComponents()
      create a list of strong components of the graph
      Returns:
    • getDenseGraph

      public Graph<DenseNode<E>> getDenseGraph()
      get a dense graph, i.e. a strong component is one node containing the original nodes
      Returns:
    • getNodes

      public List<E> getNodes()
      get the nodes of the graph
      Returns: