Package dsa.lab10.exercises
Class DirectedGraph<Vertex,Weight> 
java.lang.Object
dsa.lab10.exercises.DirectedGraph<Vertex,Weight> 
- Type Parameters:
- Vertex- the vertex type
- Weight- the weight type (on the edges)
A directed graph implemented using adjacency lists.
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct an empty directed graph.Construct a directed graph containing the given vertices and edges.
- 
Method SummaryModifier and TypeMethodDescriptionadjacencyList(Vertex source) booleanbooleanCheck if the given item is equal to any of those contained.intedges()items()Get an iterable that yields each item once.neighbours(Vertex source) intsize()Get the number of contained items.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
DirectedGraphpublic DirectedGraph()Construct an empty directed graph.
- 
DirectedGraphpublic DirectedGraph(Iterable<Vertex> vertices, Iterable<Edge<Vertex, Weight>> edges) throws IllegalArgumentExceptionConstruct a directed graph containing the given vertices and edges.- Parameters:
- vertices- the vertices
- edges- the edges
- Throws:
- IllegalArgumentException- if a source/target vertex of an edge isn't in vertices, or if multiple edges are between the same pair of source and target vertices
 
 
- 
- 
Method Details- 
sizepublic int size()Description copied from interface:ContainerGet the number of contained items.
- 
containsDescription copied from interface:ContainerCheck if the given item is equal to any of those contained.
- 
contains
- 
degree- Throws:
- NoSuchElementException
 
- 
edge
- 
itemsDescription copied from interface:ContainerGet an iterable that yields each item once.
- 
edges
- 
adjacencyList- Throws:
- NoSuchElementException
 
- 
neighbours- Throws:
- NoSuchElementException
 
 
-