Package it.unimi.di.prog2.h24.digraph
Class ArcListDiGraph<T>
java.lang.Object
it.unimi.di.prog2.h24.digraph.ArcListDiGraph<T>
- Type Parameters:
T
- the type of the graph nodes.
- All Implemented Interfaces:
DiGraph<T>
A mutable directed graph implementation based on a list of
Arc
s and one of
nodes.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty graph.ArcListDiGraph
(DiGraph<? extends T> graph) Creates a graph with the same nodes and arcs of the given graph. -
Method Summary
-
Field Details
-
nodes
The set of graph nodes.Observe that isolated nodes (node not appearing in any arc) belong to this set.
-
arcs
The set of graph arcs.
-
-
Constructor Details
-
ArcListDiGraph
public ArcListDiGraph()Creates an empty graph. -
ArcListDiGraph
Creates a graph with the same nodes and arcs of the given graph.- Parameters:
graph
- the graph to copy.- Throws:
NullPointerException
- ifgraph
isnull
.
-
-
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. -
nodes
Description copied from interface:DiGraph
Returns the graph nodes. -
arcs
Description copied from interface:DiGraph
Returns this graph arcs.
-