IGNORE_SELFLOOPS, INVERT_SELFLOOPS, REMOVE_SELFLOOPS| Constructor and Description |
|---|
DefaultGraph()
Creates an empty graph.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Edge<T> edge)
Adds the given edge to this graph.
|
boolean |
add(T node)
Adds the given node to this graph.
|
boolean |
areAdjacent(T a,
T b)
Returns "true" iff the two nodes are connected by a directed edge
from a to b or an undirected edge.
|
boolean |
contains(Object obj)
Returns "true" when this graph contains the given
node or edge.
|
static <S extends Node> |
existsDirectedPath(Graph<S> g,
S node1,
S node2)
Checks whether there is a (directed) path from node1 to node2 in the given graph.
|
boolean |
existsDirectedPath(T node1,
T node2)
Checks whether there is a (directed) path from node1 to node2.
|
net.sf.tweety.math.matrix.Matrix |
getAdjancyMatrix()
Returns the adjacency matrix of this graph (the order
of the nodes is the same as returned by "iterator()").
|
Collection<T> |
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<T> |
getComplementGraph(int selfloops)
Returns the complement graph of this graph, i.e.
|
Edge<T> |
getEdge(T a,
T b)
Returns the corresponding edge (a,b) if a and b are adjacent.
|
Collection<Edge<T>> |
getEdges()
Returns the edges of this graph.
|
Collection<T> |
getNeighbors(T node)
Returns the set of neighbors of the given node.
|
Collection<T> |
getNodes()
Returns the nodes of this graph.
|
int |
getNumberOfNodes()
Returns the number of nodes in this graph.
|
Collection<T> |
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.
|
DefaultGraph<T> |
getRestriction(Collection<T> nodes)
Returns copy of this graph consisting only of the given
nodes and all corresponding edges.
|
Collection<Collection<T>> |
getStronglyConnectedComponents()
Returns the strongly connected components of this graph.
|
static <S extends Node> |
getStronglyConnectedComponents(Graph<S> g)
Returns the strongly connected components of the given graph.
|
Collection<Graph<T>> |
getSubgraphs()
Returns the set of sub graphs of this graph.
|
static <S extends Node> |
getSubgraphs(Graph<S> g)
Returns the set of sub graphs of the given graph.
|
boolean |
hasSelfLoops()
Returns "true" iff the graph has a self loop (an edge from a node to itself).
|
boolean |
isWeightedGraph()
Checks whether this graph only contains weighted edges.
|
Iterator<T> |
iterator() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic boolean add(T node)
Graphpublic boolean add(Edge<T> edge)
Graphpublic Collection<T> getNodes()
Graphpublic int getNumberOfNodes()
GraphgetNumberOfNodes in interface Graph<T extends Node>public Collection<Edge<T>> getEdges()
Graphpublic boolean contains(Object obj)
Graphpublic Collection<T> getNeighbors(T node)
GraphgetNeighbors in interface Graph<T extends Node>node - some node (must be in the graph).public Collection<T> getChildren(Node node)
GraphgetChildren in interface Graph<T extends Node>node - some node (must be in the graph).public Collection<T> getParents(Node node)
GraphgetParents in interface Graph<T extends Node>node - some node (must be in the graph).public boolean areAdjacent(T a, T b)
GraphareAdjacent in interface Graph<T extends Node>a - some nodeb - some nodepublic Edge<T> getEdge(T a, T b)
Graphpublic boolean existsDirectedPath(T node1, T node2)
GraphexistsDirectedPath in interface Graph<T extends Node>node1 - some node.node2 - some node.public net.sf.tweety.math.matrix.Matrix getAdjancyMatrix()
GraphgetAdjancyMatrix in interface Graph<T extends Node>public String toString()
public Graph<T> getComplementGraph(int selfloops)
GraphgetComplementGraph in interface Graph<T extends Node>selfloops - Indicates how to deal with selfloops:public boolean hasSelfLoops()
GraphhasSelfLoops in interface Graph<T extends Node>public boolean isWeightedGraph()
GraphisWeightedGraph in interface Graph<T extends Node>public Collection<Collection<T>> getStronglyConnectedComponents()
GraphgetStronglyConnectedComponents in interface Graph<T extends Node>public static <S extends Node> Collection<Collection<S>> getStronglyConnectedComponents(Graph<S> g)
g - some graphpublic Collection<Graph<T>> getSubgraphs()
GraphgetSubgraphs in interface Graph<T extends Node>public static <S extends Node> Collection<Graph<S>> getSubgraphs(Graph<S> g)
public DefaultGraph<T> getRestriction(Collection<T> nodes)
GraphgetRestriction in interface Graph<T extends Node>nodes - a set of nodespublic static <S extends Node> boolean existsDirectedPath(Graph<S> g, S node1, S node2)
g - some graph.node1 - some node.node2 - some node.Copyright © 2018. All rights reserved.