Package net.sf.tweety.arg.bipolar.syntax
Class AbstractBipolarFramework
- java.lang.Object
-
- net.sf.tweety.commons.BeliefSet<BArgument,DungSignature>
-
- net.sf.tweety.arg.bipolar.syntax.AbstractBipolarFramework
-
- All Implemented Interfaces:
java.lang.Iterable<BArgument>
,java.util.Collection<BArgument>
,BeliefBase
,Graph<BArgument>
- Direct Known Subclasses:
DeductiveArgumentationFramework
,EvidentialArgumentationFramework
,NecessityArgumentationFramework
public abstract class AbstractBipolarFramework extends BeliefSet<BArgument,DungSignature> implements Graph<BArgument>
This class implements a bipolar abstract argumentation framework with attack and support relations. Both relations need to have the form (BipolarEntity, BArgument)- Author:
- Lars Bengel
-
-
Field Summary
-
Fields inherited from class net.sf.tweety.commons.BeliefSet
EQUALS_USES_SIGNATURE
-
Fields inherited from interface net.sf.tweety.graphs.Graph
IGNORE_SELFLOOPS, INVERT_SELFLOOPS, REMOVE_SELFLOOPS
-
-
Constructor Summary
Constructors Constructor Description AbstractBipolarFramework()
-
Method Summary
Modifier and Type Method Description abstract boolean
add(Attack attack)
Adds the given attack to this argumentation frameworkboolean
add(BArgument argument)
Adds argument to this argumentation frameworkabstract boolean
add(Support support)
Adds the given support to this argumentation framework.boolean
add(Argument argument)
Adds argument to this argumentation framework for better compatibility between dung theories and bipolar argumentation frameworksboolean
add(Edge<BArgument> edge)
Adds the given edge to this graph.boolean
addAllAttacks(java.util.Collection<? extends Attack> c)
Adds the set of attacks to this argumentation frameworkboolean
addAllSupports(java.util.Collection<? extends Support> c)
Adds the set of supports to this argumentation frameworkboolean
areAdjacent(BArgument a, BArgument b)
Returns "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.boolean
existsDirectedPath(BArgument node1, BArgument node2)
Checks whether there is a (directed) path from node1 to node2.ArgumentSet
faf(ArgumentSet extension)
The characteristic function of an bipolar argumentation framework: F_AF(S) = {A|A is acceptable wrt.Matrix
getAdjacencyMatrix()
Returns the adjacency matrix of this graph (the order of the nodes is the same as returned by "iterator()").java.util.Set<BArgument>
getAttacked(BipolarEntity arg)
Computes the set {A | (argument,A) in attacks}.java.util.Set<BipolarEntity>
getAttackers(BArgument argument)
Computes the set {A | (A,argument) in attacks}.abstract java.util.Set<Attack>
getAttacks()
Returns all attacks of this theory.java.util.Collection<BArgument>
getChildren(Node node)
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.Graph<BArgument>
getComplementGraph(int i)
Returns the complement graph of this graph, i.e.java.util.Set<BArgument>
getDirectSupported(BipolarEntity arg)
Computes the set {A | (argument,A) in supports}.java.util.Set<BipolarEntity>
getDirectSupporters(BArgument argument)
Computes the set {A | (A,argument) in supports}.Edge<BArgument>
getEdge(BArgument a, BArgument b)
Returns the corresponding edge (a,b) if a and b are adjacent.java.util.Collection<? extends Edge<? extends BArgument>>
getEdges()
Returns the edges of this graph.Signature
getMinimalSignature()
Returns the signature of the language of this knowledge base.java.util.Collection<BArgument>
getNeighbors(BArgument node)
Returns the set of neighbors of the given node.java.util.Collection<BArgument>
getNodes()
Returns the nodes of this graph.int
getNumberOfNodes()
Returns the number of nodes in this graph.java.util.Collection<BArgument>
getParents(Node node)
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.Graph<BArgument>
getRestriction(java.util.Collection<BArgument> collection)
Returns copy of this graph consisting only of the given nodes and all corresponding edges.java.util.Collection<java.util.Collection<BArgument>>
getStronglyConnectedComponents()
Returns the strongly connected components of this graph.java.util.Collection<Graph<BArgument>>
getSubgraphs()
Returns the set of sub graphs of this graph.abstract java.util.Set<Support>
getSupports()
Returns all supports of this theory.boolean
hasSelfLoops()
Returns "true" iff the graph has a self loop (an edge from a node to itself).abstract boolean
isAcceptable(BArgument argument, java.util.Collection<BArgument> ext)
checks whether argument is acceptable wrt.boolean
isAttackedBy(BArgument arg1, BipolarEntity arg2)
Checks whether arg1 is attacked by arg2.boolean
isDirectSupportedBy(BArgument arg1, BipolarEntity arg2)
Checks whether arg1 is directly supported by arg2.boolean
isWeightedGraph()
Checks whether this graph only contains weighted edges.java.lang.String
prettyPrint()
Pretty print of the framework.boolean
remove(Attack attack)
Removes the given attack from this argumentation framework.boolean
remove(BArgument a)
Removes the argument and all its attacks and supportsboolean
remove(Support support)
Removes the given support from this argumentation framework.boolean
removeAll(java.util.Collection<?> c)
-
Methods inherited from class net.sf.tweety.commons.BeliefSet
add, addAll, clear, contains, containsAll, equals, getSignature, hashCode, isEmpty, iterator, remove, retainAll, setSignature, size, toArray, toArray, toString
-
-
-
-
Method Detail
-
getDirectSupporters
public java.util.Set<BipolarEntity> getDirectSupporters(BArgument argument)
Computes the set {A | (A,argument) in supports}.- Parameters:
argument
- an argument- Returns:
- the set of all bipolar entities that support
argument
.
-
getDirectSupported
public java.util.Set<BArgument> getDirectSupported(BipolarEntity arg)
Computes the set {A | (argument,A) in supports}.- Parameters:
arg
- an instance of bipolar entity- Returns:
- the set of all arguments that are supported by
argument
.
-
getAttackers
public java.util.Set<BipolarEntity> getAttackers(BArgument argument)
Computes the set {A | (A,argument) in attacks}.- Parameters:
argument
- an argument- Returns:
- the set of all bipolar entities that attack
argument
.
-
getAttacked
public java.util.Set<BArgument> getAttacked(BipolarEntity arg)
Computes the set {A | (argument,A) in attacks}.- Parameters:
arg
- an instance of bipolar entity- Returns:
- the set of all arguments that are attacked by
argument
.
-
isAcceptable
public abstract boolean isAcceptable(BArgument argument, java.util.Collection<BArgument> ext)
checks whether argument is acceptable wrt. ext- Parameters:
argument
- some argumentext
- a set of arguments- Returns:
- "true" if argument is acceptable wrt. ext
-
faf
public ArgumentSet faf(ArgumentSet extension)
The characteristic function of an bipolar argumentation framework: F_AF(S) = {A|A is acceptable wrt. S}.- Parameters:
extension
- an extension (a set of arguments).- Returns:
- an extension (a set of arguments).
-
isDirectSupportedBy
public boolean isDirectSupportedBy(BArgument arg1, BipolarEntity arg2)
Checks whether arg1 is directly supported by arg2.- Parameters:
arg1
- an argument.arg2
- a bipolar entity- Returns:
- "true" if arg1 is directly supported by arg2
-
isAttackedBy
public boolean isAttackedBy(BArgument arg1, BipolarEntity arg2)
Checks whether arg1 is attacked by arg2.- Parameters:
arg1
- an argument.arg2
- a bipolar entity- Returns:
- "true" if arg1 is directly attacked by arg2
-
getSupports
public abstract java.util.Set<Support> getSupports()
Returns all supports of this theory.- Returns:
- all supports of this theory.
-
getAttacks
public abstract java.util.Set<Attack> getAttacks()
Returns all attacks of this theory.- Returns:
- all attacks of this theory.
-
add
public abstract boolean add(Support support)
Adds the given support to this argumentation framework.- Parameters:
support
- a support- Returns:
- "true" if the set of supports has been modified.
-
addAllSupports
public boolean addAllSupports(java.util.Collection<? extends Support> c)
Adds the set of supports to this argumentation framework- Parameters:
c
- a collection of supports- Returns:
- "true" if this argumentation framework has been modified.
-
add
public abstract boolean add(Attack attack)
Adds the given attack to this argumentation framework- Parameters:
attack
- an attack- Returns:
- "true" if the set of attacks has been modified.
-
addAllAttacks
public boolean addAllAttacks(java.util.Collection<? extends Attack> c)
Adds the set of attacks to this argumentation framework- Parameters:
c
- a collection of attacks- Returns:
- "true" if this argumentation framework has been modified.
-
add
public boolean add(BArgument argument)
Adds argument to this argumentation framework
-
add
public boolean add(Argument argument)
Adds argument to this argumentation framework for better compatibility between dung theories and bipolar argumentation frameworks- Parameters:
argument
- some argument- Returns:
- "true" if this framework has been modified
-
remove
public boolean remove(Support support)
Removes the given support from this argumentation framework.- Parameters:
support
- a support- Returns:
- "true" if the set of supports has been modified.
-
remove
public boolean remove(Attack attack)
Removes the given attack from this argumentation framework.- Parameters:
attack
- an attack- Returns:
- "true" if the set of supports has been modified.
-
remove
public boolean remove(BArgument a)
Removes the argument and all its attacks and supports- Parameters:
a
- some argument- Returns:
- true if this structure has been changed
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<BArgument>
- Overrides:
removeAll
in classBeliefSet<BArgument,DungSignature>
-
prettyPrint
public java.lang.String prettyPrint()
Pretty print of the framework.- Returns:
- the pretty print of the framework.
-
getMinimalSignature
public Signature getMinimalSignature()
Description copied from interface:BeliefBase
Returns the signature of the language of this knowledge base.- Specified by:
getMinimalSignature
in interfaceBeliefBase
- Returns:
- the signature of the language of this knowledge base.
-
add
public boolean add(Edge<BArgument> 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.
-
getNodes
public java.util.Collection<BArgument> getNodes()
Description copied from interface:Graph
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 interfaceGraph<BArgument>
- Returns:
- the number of nodes in this graph.
-
areAdjacent
public boolean areAdjacent(BArgument a, BArgument 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 interfaceGraph<BArgument>
- Parameters:
a
- some nodeb
- some node- Returns:
- "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.
-
getEdge
public Edge<BArgument> getEdge(BArgument a, BArgument b)
Description copied from interface:Graph
Returns the corresponding edge (a,b) if a and b are adjacent. Otherwise it returns null.
-
getEdges
public java.util.Collection<? extends Edge<? extends BArgument>> getEdges()
Description copied from interface:Graph
Returns the edges of this graph.
-
getChildren
public java.util.Collection<BArgument> 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 interfaceGraph<BArgument>
- Parameters:
node
- some node (must be in the graph).- Returns:
- the set of children of the given node.
-
getParents
public java.util.Collection<BArgument> 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 interfaceGraph<BArgument>
- Parameters:
node
- some node (must be in the graph).- Returns:
- the set of parents of the given node.
-
existsDirectedPath
public boolean existsDirectedPath(BArgument node1, BArgument node2)
Description copied from interface:Graph
Checks whether there is a (directed) path from node1 to node2.- Specified by:
existsDirectedPath
in interfaceGraph<BArgument>
- Parameters:
node1
- some node.node2
- some node.- Returns:
- "true" if there is a directed path from node1 to node2.
-
getNeighbors
public java.util.Collection<BArgument> getNeighbors(BArgument node)
Description copied from interface:Graph
Returns the set of neighbors of the given node.- Specified by:
getNeighbors
in interfaceGraph<BArgument>
- 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 interfaceGraph<BArgument>
- Returns:
- the adjacency matrix of this graph
-
getComplementGraph
public Graph<BArgument> getComplementGraph(int i)
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 interfaceGraph<BArgument>
- Parameters:
i
- 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.
-
getStronglyConnectedComponents
public java.util.Collection<java.util.Collection<BArgument>> 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 interfaceGraph<BArgument>
- Returns:
- the strongly connected components of this graph.
-
getSubgraphs
public java.util.Collection<Graph<BArgument>> getSubgraphs()
Description copied from interface:Graph
Returns the set of sub graphs of this graph.- Specified by:
getSubgraphs
in interfaceGraph<BArgument>
- Returns:
- the set of sub graphs of this graph.
-
getRestriction
public Graph<BArgument> getRestriction(java.util.Collection<BArgument> collection)
Description copied from interface:Graph
Returns copy of this graph consisting only of the given nodes and all corresponding edges.- Specified by:
getRestriction
in interfaceGraph<BArgument>
- Parameters:
collection
- a set of nodes- Returns:
- a 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 interfaceGraph<BArgument>
- 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 interfaceGraph<BArgument>
- Returns:
- "true" if all edges are weighted in this graph.
-
-