A graph with explicit edges.

The number of vertices and edges may be infinite in which case the user has to take care not to call methods which will not return (this is similar to an Iterable which may contain an infinite number of elements).

The same applies for the neighbors or adjacent edges of a vertex.

By: ThorstenSeitz

no type hierarchy

Attributes
edgesSource Codeshared formal {E*} edges

All edges of the graph.

Inherited Attributes
Attributes inherited from: Object
Attributes inherited from: AdjacencyGraph<V>
Methods
adjacentEdgesSource Codeshared default {E*} adjacentEdges(V vertex)

The adjacent edges of the given vertex. A directed edge is adjacent if it is outgoing. The edges are answered such that the following conditions hold:

   edge.source == vertex
   neighbors(vertex).contains(edge.target)
containsEdgeSource Codeshared actual default Boolean containsEdge(V source, V target)

Answer whether the graph contains an edge from source to target.

forEachAdjacentEdgeSource Codeshared void forEachAdjacentEdge(V vertex, void action(E edge))

Apply action(E) for each adjacent edge of the given vertex.

hasNeighborsSource Codeshared actual default Boolean hasNeighbors(V vertex)

Answer whether the given vertex has at least one neighbor.

neighborsSource Codeshared actual default {V*} neighbors(V vertex)

All neighbor vertices of the given vertex. A neighbor is the target of an outgoing directed edge

     or the other endpoint of an undirected edge.
Inherited Methods
Methods inherited from: Object
Methods inherited from: AdjacencyGraph<V>