Package it.unimi.di.prog2.h25.digraph
Class AdjacencyMapDiGraph<T>
java.lang.Object
it.unimi.di.prog2.h25.digraph.AdjacencyMapDiGraph<T>
- Type Parameters:
T
- the type of the graph nodes.
- All Implemented Interfaces:
DiGraph<T>
A directed graph implementation based on a
Map
between nodes and their outgoing
sets.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an arc to this graph.void
Adds a node to this graph.boolean
Tells whether an arc belongs to this graph, or not.nodes()
Returns the graph nodes.Returns the set of outgoing nodes of a given node.
-
Field Details
-
adjacency
AMap
between nodes and their outgoing sets.Every node in the graph is a key of this map, and viceversa. Isolated nodes map to
Collections.emptySet()
.
-
-
Constructor Details
-
AdjacencyMapDiGraph
public AdjacencyMapDiGraph()
-
-
Method Details
-
addArc
Description copied from interface:DiGraph
Adds an arc to this graph.It the source, or destination, node are not present in the graph, they are also added.
-
addNode
Description copied from interface:DiGraph
Adds a node to this graph. -
hasArc
Description copied from interface:DiGraph
Tells whether an arc belongs to this graph, or not. -
outgoing
Description copied from interface:DiGraph
Returns the set of outgoing nodes of a given node. -
nodes
Description copied from interface:DiGraph
Returns the graph nodes.
-