Sha256: c540ab83a7c003770f8c0be9f49635664854df3d6dbdcc004083f051e65dbb66
Contents?: true
Size: 698 Bytes
Versions: 3
Compression:
Stored size: 698 Bytes
Contents
# frozen_string_literal: true 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tangle-0.11.0 | lib/tangle/directed/acyclic/graph.rb |
tangle-0.10.2 | lib/tangle/directed/acyclic/graph.rb |
tangle-0.10.1 | lib/tangle/directed/acyclic/graph.rb |