Class SerialisationGraph

java.lang.Object
org.tweetyproject.arg.dung.serialisability.semantics.SerialisationGraph
All Implemented Interfaces:
Iterable<SerialisationState>, GeneralGraph<SerialisationState>, Graph<SerialisationState>

public class SerialisationGraph extends Object implements Graph<SerialisationState>
A Graph-based representation of the Serialisation Sequences of some Argumentation Framework wrt. some Semantics.
Author:
Lars Bengel, Julian Sander, Matthias Thimm
  • Constructor Details

    • SerialisationGraph

      public SerialisationGraph(DungTheory theory, SerialisedExtensionReasoner reasoner)
      Construct a serialisation graph for the given argumentation framework and serialisation reasoner
      Parameters:
      theory - some argumentation framework
      reasoner - some serialised reasoner
    • SerialisationGraph

      public SerialisationGraph(DungTheory theory, Semantics semantics)
      Construct a serialisation graph for the given argumentation framework and semantics
      Parameters:
      theory - some argumentation framework
      semantics - some serialisable semantics
  • Method Details

    • prettyPrint

      public String prettyPrint()
      Pretty print of the graph.
      Returns:
      the pretty print of the graph.
    • getSemantics

      public Semantics getSemantics()
      Return the semantics of this serialisation graph
      Returns:
      the semantics for which the serialisation graph has been constructed
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getExtensions

      public Collection<Extension<DungTheory>> getExtensions()
      Return the extension that the represented serialisation sequences correspond to
      Returns:
      The set of extensions
    • getNodeForExtension

      public SerialisationState getNodeForExtension(Extension<DungTheory> extension)
      Return the node of this graph that corresponds to the given extension
      Parameters:
      extension - some extension
      Returns:
      the node corresponding to the extension
    • getRestriction

      Description copied from interface: GeneralGraph
      Returns a copy of this graph that contains only the specified nodes and all corresponding edges between them.

      This method generates a subgraph (or restricted graph) from the current graph by including only the given nodes and the edges that connect them. The returned graph is a new instance and does not modify the original graph.

      Specified by:
      getRestriction in interface GeneralGraph<SerialisationState>
      Parameters:
      nodes - a collection of nodes to be included in the restricted graph.
      Returns:
      a `GeneralGraph` object representing the restricted graph.
    • add

      public boolean add(SerialisationState node)
      Description copied from interface: Graph
      Adds the given node to this graph.
      Specified by:
      add in interface Graph<SerialisationState>
      Parameters:
      node - some node.
      Returns:
      "true" iff the edge has been added successfully.
    • add

      public boolean add(GeneralEdge<SerialisationState> edge)
      Description copied from interface: Graph
      Adds the given edge to this graph. If at least one of the nodes the given edge connects is not in the graph, an illegal argument exception is thrown.
      Specified by:
      add in interface Graph<SerialisationState>
      Parameters:
      edge - some edge.
      Returns:
      "true" iff the edge has been added successfully.
    • getNodes

      public Collection<SerialisationState> getNodes()
      Description copied from interface: Graph
      Returns the nodes of this graph.
      Specified by:
      getNodes in interface GeneralGraph<SerialisationState>
      Specified by:
      getNodes in interface Graph<SerialisationState>
      Returns:
      the nodes of this graph.
    • getNumberOfNodes

      public int getNumberOfNodes()
      Description copied from interface: Graph
      Returns the number of nodes in this graph.
      Specified by:
      getNumberOfNodes in interface Graph<SerialisationState>
      Returns:
      the number of nodes in this graph.
    • getNumberOfEdges

      public int getNumberOfEdges()
      Description copied from interface: Graph
      Returns the number of edges in this graph.
      Specified by:
      getNumberOfEdges in interface Graph<SerialisationState>
      Returns:
      the number of edges in this graph.
    • areAdjacent

      public boolean areAdjacent(SerialisationState a, SerialisationState b)
      Description copied from interface: Graph
      Returns "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.
      Specified by:
      areAdjacent in interface Graph<SerialisationState>
      Parameters:
      a - some node
      b - some node
      Returns:
      "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.
    • getEdge

      Description copied from interface: Graph
      Returns the corresponding edge (a,b) if a and b are adjacent. Otherwise it returns null.
      Specified by:
      getEdge in interface Graph<SerialisationState>
      Parameters:
      a - some node
      b - some node
      Returns:
      the edge (a,b) or null.
    • getEdges

      public Collection<? extends GeneralEdge<? extends SerialisationState>> getEdges()
      Description copied from interface: Graph
      Returns the edges of this graph.
      Specified by:
      getEdges in interface GeneralGraph<SerialisationState>
      Specified by:
      getEdges in interface Graph<SerialisationState>
      Returns:
      the edges of this graph.
    • iterator

      public Iterator<SerialisationState> iterator()
      Specified by:
      iterator in interface Graph<SerialisationState>
      Specified by:
      iterator in interface Iterable<SerialisationState>
    • contains

      public boolean contains(Object obj)
      Description copied from interface: Graph
      Returns "true" when this graph contains the given node or edge.
      Specified by:
      contains in interface Graph<SerialisationState>
      Parameters:
      obj - an object
      Returns:
      "true" if this graph contains the given node or edge.
    • getChildren

      public Collection<SerialisationState> getChildren(Node node)
      Description copied from interface: Graph
      Returns the set of children (node connected via an undirected edge or a directed edge where the given node is the parent) of the given node.
      Specified by:
      getChildren in interface Graph<SerialisationState>
      Parameters:
      node - some node (must be in the graph).
      Returns:
      the set of children of the given node.
    • getParents

      public Collection<SerialisationState> getParents(Node node)
      Description copied from interface: Graph
      Returns the set of parents (node connected via an undirected edge or a directed edge where the given node is the child) of the given node.
      Specified by:
      getParents in interface Graph<SerialisationState>
      Parameters:
      node - some node (must be in the graph).
      Returns:
      the set of parents of the given node.
    • existsDirectedPath

      public boolean existsDirectedPath(SerialisationState node1, SerialisationState node2)
      Description copied from interface: Graph
      Checks whether there is a (directed) path from node1 to node2.
      Specified by:
      existsDirectedPath in interface Graph<SerialisationState>
      Parameters:
      node1 - some node.
      node2 - some node.
      Returns:
      "true" if there is a directed path from node1 to node2.
    • getNeighbors

      public Collection<SerialisationState> getNeighbors(SerialisationState node)
      Description copied from interface: Graph
      Returns the set of neighbors of the given node.
      Specified by:
      getNeighbors in interface Graph<SerialisationState>
      Parameters:
      node - some node (must be in the graph).
      Returns:
      the set of neighbors of the given node.
    • getAdjacencyMatrix

      public Matrix getAdjacencyMatrix()
      Description copied from interface: Graph
      Returns the adjacency matrix of this graph (the order of the nodes is the same as returned by "iterator()").
      Specified by:
      getAdjacencyMatrix in interface Graph<SerialisationState>
      Returns:
      the adjacency matrix of this graph
    • getComplementGraph

      public Graph<SerialisationState> getComplementGraph(int selfloops)
      Description copied from interface: Graph
      Returns the complement graph of this graph, i.e. the graph on the same set of vertices as this graph that connects two vertices v and w with an edge if and only if v and w are not connected in this graph.
      Specified by:
      getComplementGraph in interface Graph<SerialisationState>
      Parameters:
      selfloops - Indicates how to deal with selfloops:
      IGNORE_SELFLOOPS - ignore self loops (don't add and don't remove)
      INVERT_SELFLOOPS - deal with self loops like ordinary edges (add if not present and remove if present)
      REMOVE_SELFLOOPS - simple remove self loops, but don't add new ones.
      Returns:
      the complement graph of this graph.
    • getConnectedComponents

      public Collection<Collection<SerialisationState>> getConnectedComponents()
      Description copied from interface: Graph
      Returns the set of (simple) connected components of this graph. A set of nodes is connected, if there is some path (ignoring edge directions) from each node to each other. It is a connected component if it is connected and maximal wrt. set inclusion.
      Specified by:
      getConnectedComponents in interface Graph<SerialisationState>
      Returns:
      the connected components of this graph.
    • getStronglyConnectedComponents

      public Collection<Collection<SerialisationState>> getStronglyConnectedComponents()
      Description copied from interface: Graph
      Returns the strongly connected components of this graph. A set of nodes is strongly connected, if there is a path from each node to each other. A set of nodes is called strongly connected component if it is strongly connected and maximal with respect to set inclusion.
      Specified by:
      getStronglyConnectedComponents in interface Graph<SerialisationState>
      Returns:
      the strongly connected components of this graph.
    • getSubgraphs

      public Collection<Graph<SerialisationState>> getSubgraphs()
      Description copied from interface: Graph
      Returns the set of sub graphs of this graph.
      Specified by:
      getSubgraphs in interface Graph<SerialisationState>
      Returns:
      the set of sub graphs of this graph.
    • hasSelfLoops

      public boolean hasSelfLoops()
      Description copied from interface: Graph
      Returns "true" iff the graph has a self loop (an edge from a node to itself).
      Specified by:
      hasSelfLoops in interface Graph<SerialisationState>
      Returns:
      "true" iff the graph has a self loop (an edge from a node to itself).
    • isWeightedGraph

      public boolean isWeightedGraph()
      Description copied from interface: Graph
      Checks whether this graph only contains weighted edges.
      Specified by:
      isWeightedGraph in interface Graph<SerialisationState>
      Returns:
      "true" if all edges are weighted in this graph.