class base graph[readonly data vertice type, readonly data edge type]
extends debuggable
implements graph[vertice type, edge type]
private class edge[readonly data vertice type, readonly data edge type]
implements immutable data
overload base graph(equivalence relation[vertice type] equivalence)
this • equivalence = equivalence
overload base graph()
override void add edge(vertice type from, vertice type to, edge type the source)
override immutable set[vertice type] adjacent(vertice type from) pure
if edge set is null
for (edge : edge set • elements)
return empty[vertice type] • new()
return adjacent vertices • frozen copy()
override boolean introduces cycle(vertice type from, vertice type to) pure
if equivalence(from, to)
for (considered vertice : considered)
return true
for (target vertice : adjacent(considered vertice) • elements)
return false