Sha256: 29a61269e35ffc6370e38eb512205f1709349f2c9d13b2d9541dea534b47ddd1
Contents?: true
Size: 666 Bytes
Versions: 4
Compression:
Stored size: 666 Bytes
Contents
require 'tangle/directed/graph' require 'tangle/directed/acyclic/partial_order' module Tangle module Directed module Acyclic # A directed acyclic graph class Graph < Tangle::Directed::Graph # Return a topological ordering of a set of vertices, or all # vertices in the graph. def topological_ordering(*vertices) PartialOrder[self, *vertices].sort!.map(&:vertex) end protected def insert_edge(edge) raise CyclicError if successor?(edge.head, edge.tail) || predecessor?(edge.tail, edge.head) super end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems