Class: Tangle::Directed::Acyclic::Graph

Inherits:
Graph
  • Object
show all
Defined in:
lib/tangle/directed/acyclic/graph.rb

Overview

A directed acyclic graph

Constant Summary

Constants inherited from Graph

Graph::DEFAULT_MIXINS, Graph::Edge

Constants inherited from Graph

Graph::DEFAULT_MIXINS, Graph::Edge

Instance Attribute Summary

Attributes included from Mixin::Initialize

#mixins

Instance Method Summary collapse

Methods inherited from Graph

#balanced?, #direct_predecessor?, #direct_predecessors, #direct_successor?, #direct_successors, #in_degree, #in_edges, #internal?, #out_degree, #out_edges, #predecessor?, #predecessor_subgraph, #predecessors, #sink?, #source?, #successor?, #successor_subgraph, #successors

Methods inherited from Graph

[], #initialize, #subgraph, #to_s

Methods included from GraphEdges

#add_edge, #edges, #remove_edge

Methods included from GraphVertices

#[], #add_vertex, #fetch, #remove_vertex, #select, #vertices

Constructor Details

This class inherits a constructor from Tangle::Graph

Instance Method Details

#topological_ordering(*vertices) ⇒ Object

Return a topological ordering of a set of vertices, or all vertices in the graph.



11
12
13
# File 'lib/tangle/directed/acyclic/graph.rb', line 11

def topological_ordering(*vertices)
  PartialOrder[self, *vertices].sort!.map(&:vertex)
end